bug: Watch location restrict pointer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

bug: Watch location restrict pointer

Volker Weißmann
Hello,

the watch -location function does not work when watching a restrict pointer:


main.cpp:

int main() {
     void* __restrict__ ptr = 0;
}


gdbinit:

break main.cpp:2
run
watch -location ptr


result:

Breakpoint 1, main () at main.cpp:2
2           void* __restrict__ ptr = 0;
gdbinit:3: Error in sourced command file:
A syntax error in expression, near `restrict *) 0x00007fffffffd608'.


If this is not a bug, but a known limitation, please make the error
message say something like "you cannot watch -location a restrict
pointer" instead of "A syntax error in expression, near `restrict *)
0x00007fffffffd608'." I just spend 4 hours tracking this down and I
don't want anyone else to do the same again.


gdb --version: 9.1

OS: Arch Linux


Greetings

Volker Weißmann

Reply | Threaded
Open this post in threaded view
|

Re: bug: Watch location restrict pointer

Tom Tromey-2
Volker> Breakpoint 1, main () at main.cpp:2
Volker> 2           void* __restrict__ ptr = 0;
Volker> gdbinit:3: Error in sourced command file:
Volker> A syntax error in expression, near `restrict *) 0x00007fffffffd608'.

Thanks for the report.
I sent a patch to fix this.  Some variant of it should go in reasonably
soon.

As a workaround you can try something like stripping out the restrict:

watch -location (void *) ptr

Tom