Reputation: 33
We know, in C language, if there is an array
int data[100];
then ,in gdb, we can print data[4] to data[14] by typing:
print *(data+4)@11
so, the question is: when we program in Pascal language, we may have an array:
var
data: array[0..100] of Integer;
when we debug it in gdb, how can we print the value from data[4] to data[14]?
Thank you very much.
Upvotes: 3
Views: 870
Reputation: 22549
There is no way to do this when gdb's language is set to Pascal -- nobody ever implemented this extension in the Pascal expression parser.
One workaround is to print the address of the array, then temporarily switch the language to C and print *(type *)addr @ ...
.
Another workaround would be to write a new gdb command (either using the CLI or using Python) that does what you like. Or, if you are doing a lot of Pascal debugging, you could implement this extension in gdb -- it isn't hard.
Upvotes: 1