Search code examples
c++debuggingcrashgdbcoredump

Find all variables pointing to an address in gdb


For context, my particular case is the following: I got a segfault and am analyzing the core; the stack trace shows the program called exit but crashed before completing it, within some vector's d'tor; I can get the address of the vector, but I am not familiar with the code and I don't know what variable it corresponds to; I would like to find out what variables are pointing to this vector to inspect related code. Any suggestions?


Solution

  • I can get the address of the vector... I would like to find out what variables are pointing to this vector

    Having the address of some variable you can use info symbol command to print the name of a variable like this:

    (gdb) info symbol 0x4005BDC
    

    See Examining the Symbol Table in gdb documentation.