Assembly, gdb duplicate names

34 views Asked by At

Let's assume we have defined a global non-initialized variable named f in C code. Considering that, we would make label named f in the Assembly representation and put it in the .bss section. The problem I've encountered is the following:

  • Using la works fine, and loads the address of user-defined global variable into some register
  • Trying to print, or examine the symbol f in gdb returns some object at some address 0x7f7f... which is not the variable I intended to print
  • Using info variables I was able to find a static FILE *f pointer variable f probably originating from C library that got linked with the source file, and concluded it being what is getting printed in gdb
  • I also tried doing p 'file.s'::f to print the user-defined variable but had no luck with that either

So my question is how to differentiate between duplicate symbol names while debugging using gdb?

0

There are 0 answers