4

I tried to debug my Nim code in VSCodium with Native Debug extension and GDB. But I can't get the Pretty Printers to work properly.

Here is my launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug x64 Linux",
            "type": "gdb",
            "gdbpath": "nim-gdb",
            "request": "launch",
            "target": "${workspaceRoot}/bin/debug/${fileBasenameNoExtension}",
            "cwd": "${workspaceRoot}",
            "valuesFormatting": "prettyPrinters",
            "arguments": "",
            "debugger_args": []
        }
    ]
}

The nim-gdb.py is located under /usr/tools/ and will be loaded.

Here is the debugger output of the debugging session in VSCodium. It seem's that the nim-gdb.py is loaded successfully. But neither in the variables panel nor in the debugging console the values are formatted right. The str-variable is still missing and depending on where I set a breakpoint the values are often marked as <optimized out>

Debugger output

The Program was compiled with the following parameters:

nim c --outdir:"bin/debug" --debugger:native --opt:none test.nim

Compiler Version:

Nim Compiler Version 1.6.6 [Linux: amd64]
Compiled at 2022-05-22
Copyright (c) 2006-2021 by Andreas Rumpf

I know the gdb package needs to be compiled with python enabled. In my package manager is python as a dependency listed.

Is there something more I should care about?

References:

flo
  • 41
  • 2

0 Answers0