SymLevel C++ Debugger Documentation

Configuring VS Code extension

The following launch.json example adds debug configuration in VS Code that starts myexe executable for debugging with SLDB.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "sldb",
            "request": "launch",
            "name": "(sldb) Launch",
            "program": "${workspaceFolder}/myexe",
            "args": ["aaa", "bbb"]
            "environment": [
                {
                    name: "PATH",
                    value: "/some/additional/path:$PATH"
                }
            ]
        }
    ]
}

Configuration options

NameTypeDescription
typeStringThe type of the engine. Must be sldb.
requestStringRequest to execute. Must be launch or attach.
programStringAbsolute path to an executable to launch for the launch request. Process name to attach to for the attach request. Required for the launch request.
pidNumberID of process to attach to for the attach request.
argsArray of stringsCommand line arguments.
cwdStringThe working directory.
environmentArray of {"name": "", "value": ""} objectsEnvironment variables.
launchInTerminalBooleanLaunch debuggee in integrated terminal. Default value is true.
displayRawDataBooleanDisplay [Raw Data] field containing raw unformatted fields of formatted value. Default value is true.
displayHexBooleanDisplay integer values in hexadecimal format. Default value is false.
displayMinHexSizeIntegerMinimum number of bytes displayed in hexadecimal format. Default value is 4.
displayPointerAddressesBooleanDisplay memory addresses of pointer values. Default value is true.
displayStructAddressesBooleanDisplay memory addresses of class/struct/union values. Default value is false.
avoidNodebugBooleanAvoid functions with no debug info. Default value is true.
avoidStdFunctionsBooleanAvoid functions from the C++ Standard library. Default value is true.
stepThroughStdFunctionsBooleanStep through C++ Standard library functional objects code when performing step into. Default value is true.
avoidRegexListArray of stringsList of regular expressions to match functions to avoid.
stepThroughRegexListArray of stringsList of regular expressions to match functions to step through when performing step into.
markStdFunctionsBooleanMark C++ Standard library functional objects frames as subtle. Default value is true.
markRegexListArray of stringsList of regular expressions to match functions to be marked as subtle in call stack.
platformStringName of platform to connect. Available platforms:host, remote-freebsd, remote-linux,remote-netbsd,remote-openbsd, remote-windows, remote-android,remote-ios, remote-macosx, remote-gdb-server.
platformUrlStringURL of platform to connect. For most platforms, URL contains host name and port number in the form of <host-name>:<port>. For the android platform, URL is a device name. If URL is empty for the android platform then default device is used.
initCommandsArray of stringsList of debugger initialization commands.
execSearchPathsArray of stringsList of local paths to search for loaded executables and shared libraries.
androidSdkStringPath to Android SDK for the android platform.
androidNdkStringPath to Android NDK for the android platform.
androidJdbStringOptional path to JDB to use with the android platform.
logToOutputBooleanSend Debug Adapter Protocol server executabe log to output. Default value if true.
logLevelStringLogging level for Debug Adapter Protocol server executabe. Allowed values: fatal, error, warning,info, debug, trace. Default value is info.

Android debugging

Standalone application

To start Android debugging in standalone application you need to perform the following steps:

  1. Configure paths to Android SDK and NDK, and optional path to the jdb debugger in the Settings dialog.
  2. Click Open... in the File menu.
  3. Set the following fields in the Load executable dialog:
    • Select "android" in the Platform combo box.
    • Set launch target to application ID and activity name in the form of <app-id>/<activity-name>, for example com.example.testapp/.MainActivity.
    • Add paths to debug versions of native libraries in the list of shared libraries search paths.
  4. Click Ok and start debugging from the main menu or toolbar.

Alternatively, you can set Android target from command line, for example:


sldb --platform=android \
        --init="settings set target.exec-search-paths /path/to/libs" \
        "com.example.testapp/.MainActivity"

VS Code extension

To start debugging on local Android device or emulator you need to set the following parameters in the launch configuration:

  • The androidSdk parameter should be set to the full path to Android SDK.
  • The androidNdk parameter should be set to the full path to Android NDK.
  • The androidJdb parameter should be set to the full path to jdb debugger from JDK or Android Studio. You can leave it empty to use jdb from PATH environment variable.
  • The platform parameter should be set to android.
  • The platform-url parameter should be set to name of Android device or emulator. You can leave it empty to use default device or emulator.
  • The program parameter should be set to ID of the application and name of the activity in the form of <app-id>/<activity-name>, for example com.example.myapp/.MainActivity.
  • The execSearchPaths parameter should be set to array of paths to native shared libraries with debug info used in application.

Example of Android launch configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "sldb",
            "request": "launch",
            "name": "(sldb) Launch Android",
            "platform": "android",
            "program": "com.example.testapp/.MainActivity",
            "execSearchPaths": [
                "/home/user/AndroidStudioProjects/TestApp/app/build/intermediates/cmake/debug/obj/x86_64"
            ],
            "androidSdk": "/home/user/Android/Sdk",
            "androidNdk": "/home/user/Android/Sdk/ndk/21.0.6113669"
        }
    ]
}