gdb: No symbol “i” in current context

后端 未结 6 486
谎友^
谎友^ 2021-02-02 10:02

While debugging a C program in gdb I have a breakpoint in a for loop. I cannot print the value of \"i\" ( I get : No symbol \"i\" in current context.). I can print the value of

6条回答
  •  难免孤独
    2021-02-02 10:42

    I encountered this issue recently. I compiled GCC 5.1 and then used it to compile a C++11 codebase. And, although I could step through the program's code in gdb, I couldn't print the value of any variable, I kept getting “No symbol "xyz" in current context” errors, for every variable.

    I was using gdb 7.4, but the latest version available at the time was 7.9. I downloaded the latest version of gdb and compiled it (using GCC 5.1) and when using gdb 7.9 I was able to successfully inspect variable values again.

    I guess the debug information of GCC 5.1 is incompatible with gdb 7.4.

提交回复
热议问题