Reputation: 11
I am trying to use the push_back function for a vector in c++. I am getting a seg fault and when I ran the gdb to find the exact reason.
I get the following.
$1={px = 0xbfffe9c4, pn = { pi_ = 0x8049c0b}}
I do not have much experience with gdb and cannot find anything related to this specific issue online.
Upvotes: 1
Views: 692
Reputation: 70402
My magic ball tells me you crashed while dereferencing a shared_ptr
. Follow the px
member, since that is the actual pointer value of interest to you. For example, you can try:
print $1.px
and if the pointer points to a valid memory area:
print *$1.px
The gdb
debugger will provide you with a lot of information, but some of the more useful things: backtrace
, up
, down
, info locals
, and if you are multi-threaded, thread apply all backtrace
. If you are debugging live, then of course you will need breakpoint
, next
, step
and continue
. You should be able to use gdb
's help for more information, and the gdb
manual is readily available online.
Upvotes: 3