Reputation: 117
I'm debugging a core dump of my program (post-mortem) inside gdb. I opened it with: gdb [program_name] [core_name]
However when I attempt to inspect a STL vector, e.g. print vec->size() or print vec->at(0)
I get the error
"You can't do that without a process to debug"
I'm just trying to inspect the contents and sizes of these containers. Is there any way to attach a dummy process to a core-dump gdb inspection so I can do this?
Upvotes: 4
Views: 3711
Reputation: 40877
print the vector:
(gdb) print *vec
Then familiarize yourself with the internals of your implementation's vector and print the raw buffer. Often called "_M_buffer" or something like that. Depending on how yours is done there may be an internal object that the buffer is inside of.
Upvotes: 2