Show: Delphi C++
Display Preferences

Debugging C++Builder 64-Bit Windows Applications

From RAD Studio XE3
Jump to: navigation, search

Go Up to C++Builder 64-bit Windows Application Development


Contents

C++Builder 64-bit Windows (BCC64) generates debug information in DWARF format, which is different from the format used by BCC32 and BCCOSX. However, in general, debugging C++ 64-bit Windows applications is similar to debugging C++ 32-bit Windows applications. There are some differences, as described here:

  • Some debugger features are not 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.


Call Stack Differences

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
Note: 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 or this post: http://stackoverflow.com/questions/6921295/dual-emission-of-constructor-symbols.

Evaluating Function Calls Such as strcmp()

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

#include <system.hpp>
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"); 

See strcmp, _mbscmp, wcscmp.

See Also

Personal tools
Previous Versions
In other languages