Can anyone explain this behavior of gdb?
900 memset(&new_ckpt_info,\'\\0\',sizeof(CKPT_INFO));
(gdb)
**903 prev_offset = cp_node->of
When debugging optimized programs (which may be necessary if the bug doesn't show up in debug builds), you often have to understand assembly compiler generated.
In your particular case, return value of cpnd_find_exact_ckptinfo
will be stored in the register which is used on your platform for return values. On ix86
, that would be %eax
. On x86_64
: %rax
, etc. You may need to google for '[your processor] procedure calling convention' if it's none of the above.
You can examine that register in GDB
and you can set it. E.g. on ix86
:
(gdb) p $eax
(gdb) set $eax = 0