p 'CV::m(int)' vs p CV::m(int)

Keith Seitz keiths@redhat.com
Thu Jul 21 18:17:00 GMT 2016


On 07/15/2016 06:49 AM, Yao Qi wrote:
> Hi,
> I just notice that p 'CV::m(int)' is different p CV::m(int), (with and
> without single quote).  Where do we document p 'CV::m(int)'?  I see
> https://sourceware.org/gdb/onlinedocs/gdb/Variables.html
> but it is about using single quote before "::".   However, the usage
> like 'CV::m(int)' isn't documented there.

I was hoping someone with more history on this hack would speak up, but
it doesn't appear that anyone is going to fess up to this. Therefore,
having expended a considerable amount of energy on removing this hack, I
offer my $.00002 (USD).

IIRC this originated as a way of bypassing the parser sometime after C++
"support" was added to GDB. Rather like a "literal," the whole token is
taken verbatim. We look for *exactly* that literal in the symbol table.
Much easier than fixing the parser bugs!

I have tried over the past several years to slowly remove the need for
such hacks. [Linespec had a similar hack, which now only exists for
backward "compatibility," i.e., maintaining previous buggy behavior.]

I would really prefer we stop broadcasting this workaround and encourage
users to file bugs, and, of course, for developers to (continue to) fix
them!

Keith



More information about the Gdb mailing list