I am in a GDB debugging session and I have an array of length 20,000. Most of the elements are zero but there is a couple of them at around index 10000
which are of interest. Unfortunately, when I say p the_array[10000]@30
or something I get "only values in memory can be extended with '@'". How can I visualize a region of that array without having to manually request each index over a range of say 40-50 elements?
I would expect this to work. And it does work for me. I have this little program:
int x[10000];
Now in gdb:
(gdb) p x[50]@3
$2 = {0, 0, 0}
Many details are missing from your question. Maybe your gdb has a bug. Or maybe your array is odd in some respect. The gdb version and things like "whatis the_array" might be interesting.
Looks like we cannot use addresses to extend the memory regions
(gdb) p (struct tfc *)0x1d88a010@100
Only values in memory can be extended with '@'.
But this works fine
(gdb) p *tfc->buckets@100
$87 = {0x0 <repeats 49 times>, 0x7f3b63a1b060, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f3b21816c90, 0x0 <repeats 18 times>, 0x7f3ae97f9e80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f3b49c96760, 0x0 <repeats 14 times>, 0x7f3adb16d8f0}
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