I just noticed that I can not debug rvalue references with gdb-7.7.1
properly.
void simple(int &&i) {}
When I enter this minimalistic function I can not obtain any meaningful information about i
. It's type and value are unknown to gdb
.
simple(int&&) (i=<unknown type in /tmp/test, CU 0x0, DIE 0xcd78>) at test.cpp:10
(gdb) p i
$2 = <unknown type in /tmp/test, CU 0x0, DIE 0xcd78>
Am I doing something wrong? Are there any sensible workarounds? Will upgrading to gdb-7.10
solve this issue?
Unfortunatelly this is caused by a GDB Bug : 14441 - Need to support DW_TAG_rvalue_reference_type
This was fixed in GDB 8.0.
Reference: https://sourceware.org/bugzilla/show_bug.cgi?id=14441
Workaround
Until it is fixed the value of i
in the above example can be obtained by explicit casting like that:
(gdb) p *(int*)i
$3 = 69
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