Frage

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?

War es hilfreich?

Lösung

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.

Andere Tipps

You can make a breakpoint right before the crash and print all the variables within the std::vector.

print *(your_vector._M_impl._M_start)@your_vector.size()

for example:

with std::vector<int> vec(3); you would write print *(vec._M_impl._M_start)@3

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top