Nikita Karasyev
Nikita Karasyev

Reputation: 21

v8 no local variables in debugger

I compiled v8 on Linux Min 20.2 using VsCode.

My build tasks.json task looks like this

 "tasks": [
 {
   "label": "gm x64.debug all",
   "type": "shell",
   "command": "tools/dev/gm.py x64.debug all",
   "group": {
     "kind": "build",
     "isDefault": true
   },
   "presentation": {
     "reveal": "always",
     "panel": "dedicated",
     "clear": true
   },
   "problemMatcher": {
     "fileLocation": [
       "relative",
       "${workspaceFolder}out/x64.debug/"
     ],
     "pattern": {
       "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
       "file": 1,
       "line": 2,
       "column": 3,
       "severity": 4,
       "message": 5
     }
   }
 }

launch.json config

    {
        "name": "(gdb) launch hello_world",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/out/x64.debug/v8_hello_world",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${fileDirname}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    },

Breakpoints working well also callstack is available but there is no local variables. I use extension "C/C++ (by Microsoft)".

How I can enable them?

Upvotes: 0

Views: 130

Answers (1)

jmrk
jmrk

Reputation: 40561

(V8 developer here.)

Inspecting local variables should work by default. You could try running the compiled binary in GDB to see if something is missing from the binaries, or it's an issue with VSCode's integrated debugger or its configuration.

One thing to keep in mind is that tools/dev/gm.py will not overwrite existing build settings. If you e.g. manually put symbol_level = 1 or v8_optimized_debug = true (two examples for settings that will break your debugging experience) into out/x64.debug/args.gn, then gm.py will maintain these settings, assuming that you put them there on purpose. To get back to the defaults, you can rm -rf out/x64.debug. You can also look up the default settings in gm.py's source.

Upvotes: 1

Related Questions