Macro info NOT accessible with GDB-trunk

Tomar, Sourabh Singh SourabhSingh.Tomar@amd.com
Mon May 17 16:35:15 GMT 2021


[AMD Public Use]

Hello Everyone,

With nearly-trunk based GDB, GDB is not able to show macro info for binaries compiled with
GCC & CLANG.

**NOTE**: It happens only for relative paths:
$tot-gcc -gdwarf-4 -g3 ./macro.c  // GDB able to show the 
OR
$clang -g -fdebug-macro ./macro.c  // -g defaults to Dwarfv4 in clang
GDB showing macro info **correctly**.

Details:
```
>llvm-dev>>>sourabh@llvm:~/work/dwarf/c_c++$ gdb --version
GNU gdb (GDB) 11.0.50.20210512-git
Using CLANG
>llvm-dev>>>sourabh@llvm:~/work/dwarf/c_c++$ clang --version
clang version 13.0.0 (https://github.com/llvm/llvm-project.git 5064a34165ccadf4718b2c159eff41f008261681)
>llvm-dev>>>sourabh@llvm:~/work/dwarf/c_c++$ clang -g -fdebug-macro macro.c
>llvm-dev>>>sourabh@llvm:~/work/dwarf/c_c++$ gdb a.out -q
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x201664: file macro.c, line 2.
Starting program: /home/sourabh/work/dwarf/c_c++/a.out

Temporary breakpoint 1, main () at macro.c:2
2       int main() {}
(gdb) info macros
(gdb) q

Using GCC:
>llvm-dev>>>sourabh@llvm:~/work/dwarf/c_c++$ tot-gcc --version
gcc (GCC) 12.0.0 20210514 (experimental)
>llvm-dev>>>sourabh@llvm:~/work/dwarf/c_c++$ tot-gcc -gdwarf-4 -g3 macro.c
>llvm-dev>>>sourabh@llvm:~/work/dwarf/c_c++$ gdb a.out -q
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x40048f: file macro.c, line 2.
Starting program: /home/sourabh/work/dwarf/c_c++/a.out

Temporary breakpoint 1, main () at macro.c:2
2       int main() {}
(gdb) info macros
(gdb) q
```
Can somebody please validate this ?

I wanted to know if anyone aware any macro related commit happened within last 10-20 days' time frame.
I'm investigating this, Any pointers greatly appreciated.

Thanks!
Sourabh.


More information about the Gdb mailing list