How do I check the current line number that I'm stopped in when debugging with GDB? I would have thought this would be obvious (and maybe it is) but I don't see it on the GDB Cheat Sheet.
Some digging around revealed the following methods:
frame
: This command was exactly what I was looking for. Output looked as follows:
(gdb) frame #0 MyDialog::on_saveButton_clicked (this=0x72bf9e0) at src/ui/dialog/MyDialog.cxx:86 86 _item->save(); (gdb)
where
or bt
(same effect): This prints out the call stack, ending on the current line.
list *$pc
: This doesn't tell you the exact line but it prints out the surrounding lines with the current line in the center.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With