Enabling logging for the RAD Studio debuggers
Go Up to Debugging Applications Index
Debugger logs can help diagnose and understand unexpected behavior when debugging, such as helping isolate bugs in the debugger itself.
These logs are enabled by setting environment variables, but there are different debuggers for different platforms. This means different environment variables need to be set to generate the logs depending on the platform.
To generate logs follow these steps:
- Exit the IDE (and PAServer if you are remote debugging)
- Delete any existing logs beforehand (so that we only get one set of logs that represent the problem)
- Set all environment variables as specified below that apply to the platform (make sure all output directories specified exist and can be written to)
- Launch the IDE (and PAServer if you are remote debugging)
- Run the debugger and do only what is necessary to reproduce the bug
- Exit the IDE (and PAServer if you are remote debugging)
- Collect all debugger logs generated and attach them to your bug report or support request.
- Any output directories specified in the settings must exist before launching the IDE (and/or PAServer if remote debugging).
- You must have write access to the output directories specified in the settings (if any) especially for Windows 10 and macOS.
- You may need to exit the IDE before the logs can be viewed (depending on the platform).
Contents
DBK logs
Windows-hosted DBK logs (Win32 & Win64)
To get the debugger logs on a Windows machine:
- Launch bds.exe
- Open Tools>Options>IDE>Environment Variables
- In User System Overrides, click New... to add the following environment variable name/value pairs:
DBK_DEBUG all
DBK_DEBUG_OUTDIR d:\MyLogsDirectory
To disable the debugger logs in the next debug session:
- Open Tools>Options>IDE>Environment Variables
- Select the DBK_DEBUG variable and click Delete
- Select the DBK_DEBUG_OUTDIR variable and click Delete
For each run of the debugger:
- On Win32, you will find DBK logs named dbk_<pid1>.log (for the debug server) and dbk_<pid2>_N.log (for the debugger) in MyLogDirectory.
- On Win64, you will find DBK logs named dbk_<pid1>.log (for the Win32-hosted driver), dbk_<pid2>.log (for the debug server), and dbk_<pid3>_N.log (for the debugger) in MyLogsDirectory.
LLDB logs
Windows-hosted LLDB logs (Win64, Android32, and Android64)
To get the debugger logs on a Windows machine:
- Launch bds.exe
- Open Tools>Options>IDE>Environment Variables
- In User System Overrides, click New... to add the following environment variable name/value pairs:
GDB_DEBUG 1
GDB_OUTDIR d:\MyLogsDirectory
To disable the LLDB logs in the next debug session:
- Open Tools>Options>IDE>Environment Variables
- Select the GDB_DEBUG variable and click Delete
- Select the GDB_OUTDIR variable and click Delete
For each run of the debugger, you will find the IDE's log(s) named gdb_<pid>.log in MyLogsDirectory if GDB_OUTDIR is set. If it is not set, then the logs will be placed in the bds bin directory.
macOS-hosted LLDB logs (iOS64, iOS Simulator ARM64, macOS 64, and macOS ARM64)
To get the debugger logs on a Mac machine, first, open a terminal window. Go to the directory where PAServer is installed. Type the following command:
export GDB_DEBUG=1 export GDB_OUTDIR=~/MyLogDirectory ./paserver
You will find the IDE´s log(s) named lldb_<pid>.log in MyLogsDirectory if GDB_OUTDIR is set. If it is not set, then the logs will be placed in the same directory as the paserver's binary.
Known Issues & Workarounds
If the IDE cannot start a debug session for a Delphi application on Windows 64-bit platform due to the port conflict, do the following:
To set this DBK_DEBUG_PORT:
- Open Tools>Options>IDE>Environment Variables
- In User System Overrides, click New... to add the following environment variable name/value pairs:
DBK_DEBUG_PORT 12345
- Relaunch the IDE
The Delphi application for Windows 64-bit platform debug session will use this new port number. To reset to the default one, delete this newly added env variable, and relaunch the IDE.