microsoft / microsoft/vscode-cpptools
GDB commands often fail with 'No symbol "someSymbol" in current context.'
@WardenGnaw arbeitet bereits daran.
Seit 01.4.2020.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
Type: Debugger
Describe the bug
- OS and Version: Debian 9
- VS Code Version: 1.43.2
- C/C++ Extension Version: 27.0
- Other extensions you installed (and if the issue persists after disabling them): None
- A clear and concise description of what the bug is.
When debugging I find that when I first try to execute a gdb command with -exec, I get the error 'No symbol "someSymbol" in current context.' even though that variable is clearly in scope. If I hover over the variable or execute a non-gdb command first, and then execute the gdb command, that fixes the problem.
I attached a small repro where I can reproduce the problem by doing the following:
- Add a breakpoint inside Widget::doStuff
- Start debugging and switch away from the "Run/Debug" view before hitting the breakpoint. Go to the explorer view, for example.
- After hitting the breakpoint, try running '-exec p a' in the debug console and note that it doesn't work
- Switch back to the "Run/Debug" view and execute a gdb command. It works now.
This reproduces very frequently when trying to debug our project at work. I noticed that it happens most often when trying to print a member variable from within a method. Local variables often work. I attached the log output after following the above repro steps on my work example.
Compile the repro with g++ -g main.cpp and debug with the following launch.json:
{
"name": "Debug Repro",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"miDebuggerPath": "/usr/bin/gdb"
}
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.