From: Paul Smith <psmith@gnu.org>
To: gdb@sourceware.org
Subject: Why are my xmethods not being invoked?
Date: Tue, 24 Jan 2023 20:20:48 -0500 [thread overview]
Message-ID: <2f56942964f9bded189c4789bda5130a91071f5d.camel@gnu.org> (raw)
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?
reply other threads:[~2023-01-25 1:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2f56942964f9bded189c4789bda5130a91071f5d.camel@gnu.org \
--to=psmith@gnu.org \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).