I'd like to debug a program that uses the dollars in identifiers extension.
Take
#include <stdio.h>
int main()
{
int $a = 42, b= 43;
printf("%d %d\n", $a, b);
}
for a simplified example. If I run it under gdb, I can inspect b using p b, but for p $a I get void. I can only show the value with info locals.
Is there a way to refer to $-containing identifiers in gdb?
gdb interprets the initial $ in p $a before parsing the expression to print.
Note however that it only does this for the initial $: if the $ sign appears in the middle of a symbol, (eg: p a$1) the variable is printed correctly.
A work-around for local variables whose name start with a dollar-sign is to print all local variables with
info locals
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