Re: Is this a bug in gdb
Luis Machado <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <[email protected]> |
On 2/16/20 7:40 PM, Volker Weißmann wrote: > Hello, > > The help text of the watch command claims that the -l option watches the > memory of the variable. When I tried this, I was surprised by the > outcome (reproducible): > > > (gdb) watch this->v_ > Hardware watchpoint 2: this->v_ This command tells GDB to watch the value of this->v_, whatever address &(this->v_) points to. That, of course, can change across the execution of the program. > (gdb) watch -l this->v_ This command tells GDB to watch for changes in a particular location. Since this->v_ is a value rather than a location, the error is thrown. The correct invocation would be ... > A syntax error in expression, near `restrict *) 0x00007fffffffd398'. > (gdb) > > Note: Using print &(this->v_) and watch (char[8]) > *outputoftheprintcommand worked. > ... the above. It points to an address that will be watched. > > I am asking you whether this is a bug in gdb or not, because if it is a > bug in gdb, I will try to make a minimal example an file a bug report. I don't think it is a bug. But maybe the documentation isn't doing a good enough job of making it clear how to invoke these commands?