Why are my xmethods not being invoked?

Paul Smith via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Organization GNU's Not UNIX!
Message-ID <[email protected]>
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?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.