public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Why are my xmethods not being invoked?
@ 2023-01-25  1:20 Paul Smith
  0 siblings, 0 replies; only message in thread
From: Paul Smith @ 2023-01-25  1:20 UTC (permalink / raw)
  To: gdb

I have a C++ program that has a home-grown smart pointer wrapper and I
want to create an xmethod for operator-> and operator* for this type.

I've followed all the rules carefully (I think!) and used the
std::unique_ptr<> xmethods from the GCC STL as an example, but the
match() method on my XMethodMatcher object is not ever getting called.

I added gdb.write() calls before I register the matcher class, and in
the __init__() of my matcher class, and in the match() method of my
matcher class.

When I start GDB I see the gdb.write() output when I register and
output for the init() of the matcher class so I know that's happening.
I can also see my operators shown in the output of "info xmethod":

  (gdb) info xmethod
    MyRefObject:
      operator->
      operator*
    ...

But, when I try to print a value using "*o" or "o->xxx" where "o" is a
local variable of type MyRefObject<Foo>, the gdb.write() call in my
match() method is never invoked at all.

How does GDB decide which xmethod match() functions should be invoked,
and which should not be invoked?  Is there some other magic I need to
do to get this hooked up?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-25  1:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25  1:20 Why are my xmethods not being invoked? Paul Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).