From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id EC8E4385B512 for ; Wed, 25 Jan 2023 01:20:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC8E4385B512 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKUT4-0003kx-Bz for gdb@sourceware.org; Tue, 24 Jan 2023 20:20:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:To:From:Subject:in-reply-to: references; bh=l8Qe0nq+YuRDd58ngsGUDIXq3HEM5tkQdUOpbpp0hTM=; b=NhNHVfxxugdPZk 4XK7CkmBfrrW4Gn3kvLLNlF7807y/gDSvlDeaAKBcroKIAaZOdPkSPo86XXKn/FWOi6jOiS2KPOMS ZcGv58bMAcfHU8S0zv8dB3kh0UvBjcblrs84qX5CZFD7i0f2Lm18ybHwb7u/QUK57GQz/I/PSZquE sQix20RrecKuABH5RZU8NBRLlL0IcSkXchwKdHwQEG78j4bmgaUWBdXffE1Z/bJBVTwgqBWXB21Mq z6it2fHfcW6KezBe+fvEIuGHD1Z36OIJiKwz/COxt1Wv/n9gvv3e7LAXduPEEUl5l9+FVslDYFw3L BsbcPrbvB54emTx5dxow==; Received: from pool-71-245-225-93.bstnma.fios.verizon.net ([71.245.225.93] helo=[192.168.50.246]) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKUT4-0008Tc-4V for gdb@sourceware.org; Tue, 24 Jan 2023 20:20:50 -0500 Message-ID: <2f56942964f9bded189c4789bda5130a91071f5d.camel@gnu.org> Subject: Why are my xmethods not being invoked? From: Paul Smith Reply-To: psmith@gnu.org To: gdb@sourceware.org Date: Tue, 24 Jan 2023 20:20:48 -0500 Organization: GNU's Not UNIX! Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.3 (by Flathub.org) MIME-Version: 1.0 X-Spam-Status: No, score=1.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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, 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?