Is there a way to get human readable strings and booleans in VSCode debugging?
Debugging successfully stops at breakpoints. Ints, floats, arrays are human readable in the debug panel.
But string values look like 0x000000010012c048 and booleans look like '\x01'.
I use mac, native debug and lldb (gdb doesn't work). Here are my code, launch.json and tasks.json:
proc run =
var a = 123
var b = "456"
var c = true
echo a, b, c
run()
#[
tasks.json:
{
"version": "2.0.0",
"tasks": [{
"label": "nimbuild",
"type": "shell",
"command": "nim c --debugger:native ${file}",
}]
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(lldb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"preLaunchTask": "nimbuild",
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb"
}
]
}
]#
Here's an how I set things up: https://github.com/russpowers/nim-debug-example
It uses python to customize the gdb output, which generally works pretty well. You still get a lot of junk variables, but the ones you care about are usually there.
Unfortunately this won't work - GDB doesn't work on Mac since 10.14 Mojave
GDB does work with Mac (I have it setup on 10.15). You just have to go through a complicated process to sign the binary:
https://sourceware.org/gdb/wiki/PermissionsDarwin#Sign_and_entitle_the_gdb_binary