Skip to content

The 25 days of C++mas - December 9 - C++Builder 64-bit Debugging

Debugging C++Builder XE3 64-bit Windows applications is similar to debugging C++Builder  32-bit Windows applications. You can find additional about debugging C++ (and Delphi) applications on the Embarcadero DocWiki (see links below). In C++Builder XE3 for 64-bit Windows, there are some differences in debugging using the IDE. These are also listed below.

Debugging in the IDE

The Embarcadero DocWiki has several articles about how to use the IDE debugger for both 32-bit and 64-bit applications.  The follow links contain an overview and additional debugging information:

C++Builder 64-bit Debugging

Some debugger features are not currently supported. Debugging of properties, closures, class methods and other Delphi language extensions is not currently supported. For example, on the Debug Inspector, the Methods and Properties tabs are not displayed for C++ 64-bit Windows applications.

Unicode, code pages, and localization are not fully supported. For example, Unicode is not supported in identifier names, and code pages are not supported by the C++ 64-bit Windows debugger.

When evaluating a 64-bit Windows register, the register name must be prefixed with $, such as $rax.
See Evaluate/Modify.

Function calls that throw exceptions are handled as follows:

  • If a function contains a try/except/catch block, and a C++ or OS/SEH exception is raised during execution, the function call finishes correctly, but the result is undefined or 0. In this case, the internal exception block is not executed because the exception is handled directly by the debugger.
  • If a function contains a try/except/catch block, and no language or OS/SEH exceptions are raised, the function call finishes fine and the result is correct, depending on the function.

Some values might be displayed differently in the 64-bit evaluator than in the 32-bit evaluator. For example, the call stack is displayed without function parameters and values.

The call stack typically contains two copies of each constructor and destructor. For example, the call stack might contain:

    :0000000000401244 ; MyClass::~MyClass
    :0000000000401229 ; MyClass::~MyClass
    :0000000000401187 ; main
    :000000000040ef90 ; _startup

Clang implements the Itanium ABI, which describes three constructors and three destructors that chain call each other. However, Clang implemented only two of the three constructors, and C++Builder added the third kind for Delphi-style classes. See the Itanium ABI doc (pdf file) or this post on Stack Overflow: http://stackoverflow.com/questions/6921295/dual-emission-of-constructor-symbols.

Evaluation for a function call such as strcmp(str, "ABC") could return an error as follows:

    #include
    int main()
    {
    char *str = "ABC";
    return strcmp(str, "ABC");
    }
    error: 'strcmp' has unknown return type; cast the call to its declared return type
    error: 1 errors parsing expression

In the Evaluate/Modify window, you need to cast the return type for strcmp():

    (int) strcmp(str, "ABC");

CodeRage 7 C++ Conference, December 10-12, 2012

The CodeRage 7 C++ conference starts next Monday, December 10, 2012 at 6am Pacific Standard Time (14:00 UTC).  There are 3 days of C++ sessions including my special live, online conversation with Bjarne Stroustrup at 8am PST (16:00 UTC) on Monday.  Some of the C++ sessions you won’t want to miss are included in my blog post on November 21 - http://blogs.embarcadero.com/davidi/2012/11/21/41993.

Happy C++mas!

During the first 25 days of December leading up to Christmas, I will blog about the upcoming release of the C++Builder 64-bit compiler for Microsoft Windows and C++Builder XE3support for building VCL and FireMonkey 2 applications.

{ 1 } Comments

  1. Peter Evans | December 17, 2012 at 4:23 am | Permalink

    Thanks David for the information regarding BCC64. Quoting "Clang does support inline assembly, but with line-by-line AT&T syntax", does this facility get up to BCC64 and if so could we see at least one explicit example? Also could you let us know exatly what ’switches’ are needed to be activated, and indeed the reverse, to make this work. So far in my tests I have not succeeded. I do hope you can help as I have been waiting for this for a long time following my successful use of ‘asm’ in BCC32 and now anticipate moving on to 64bits.

    Best regards.

Post a Comment

Your email is never published nor shared. Required fields are marked *

Bad Behavior has blocked 4 access attempts in the last 7 days.

Close