From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0fMOBVLcz2q/7QoAWB0awg (envelope-from ) for ; Wed, 14 Oct 2026 15:47:30 -0400 Received: by simark.ca (Postfix, from userid 112) id 032571E04F; Wed, 14 Oct 2026 15:47:29 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 67CF41E050 for ; Wed, 14 Oct 2026 15:47:10 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 408774BA23D6 for ; Wed, 14 Oct 2026 19:47:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 408774BA23D6 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 0A40C4BA2E15 for ; Wed, 14 Oct 2026 19:46:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A40C4BA2E15 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0A40C4BA2E15 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792007171; cv=none; b=xLJHo1e9yQjR75iTGe7P9nrh4GdY36uwVRXbAuItKWuxN7hBpzDU8snmWvllTq+jR3a+lO2xH91sB4a7RboJJprkCYf0KbXT6bbFS52rOPta9aqDWk/GyEUfVV3ch5h0wklNQEd/xgR/BgmgHwn56KgiuvWWfpzkupQ0jE4BnC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792007171; c=relaxed/simple; bh=ZvsIUxTz5grFCwqZ/5j/3LRHRDxlWJgaIMUVQM6dPms=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=tdfzmwNUrRMY0n/V3n2Y6c/3nLWiJfTg3ByFTPTCryKwaJuyyoSwgVTduxNbtq67FkLpX//HZrecXTRU3qjlj9w0jrTkIH11XpqDC+JFrwEES1LDB1tcYOgYG21YAt1KC+emgeaJPEVKbr6eiX9JGG99cu8A0rnesu4+uBTheiU= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0A40C4BA2E15 Received: by simark.ca (Postfix) id 069CB1E04E; Wed, 14 Oct 2026 15:46:08 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [pushed 1/2] gdb: make class_name_from_physname return gdb::unique_xmalloc_ptr Date: Wed, 14 Oct 2026 15:46:01 -0400 Message-ID: <20261014194606.523510-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.56.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Change language_defn::class_name_from_physname and cp_class_name_from_physname to return a gdb::unique_xmalloc_ptr instead of a raw pointer. Change-Id: Ie050a6f301331232ecee0aa810236889e159055c --- gdb/c-lang.c | 3 ++- gdb/cp-support.c | 4 ++-- gdb/cp-support.h | 3 ++- gdb/dwarf2/read.c | 2 +- gdb/language.h | 3 ++- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 6bc0782846bc..840320e76cc0 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -953,7 +953,8 @@ class cplus_language : public language_defn /* See language.h. */ - char *class_name_from_physname (const char *physname) const override + gdb::unique_xmalloc_ptr class_name_from_physname + (const char *physname) const override { return cp_class_name_from_physname (physname); } diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 2eb4539d7b4a..c386f7fea271 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -714,7 +714,7 @@ mangled_name_to_comp (const char *mangled_name, int options, /* Return the name of the class containing method PHYSNAME. */ -char * +gdb::unique_xmalloc_ptr cp_class_name_from_physname (const char *physname) { void *storage = NULL; @@ -797,7 +797,7 @@ cp_class_name_from_physname (const char *physname) } xfree (storage); - return ret.release (); + return ret; } /* Return the child of COMP which is the basename of a method, diff --git a/gdb/cp-support.h b/gdb/cp-support.h index da8e777f516b..87eee25a5798 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -90,7 +90,8 @@ using canonicalization_ftype = const char * (struct type *, void *); extern gdb::unique_xmalloc_ptr cp_canonicalize_string_full (const char *string, canonicalization_ftype *finder, void *data); -extern char *cp_class_name_from_physname (const char *physname); +extern gdb::unique_xmalloc_ptr cp_class_name_from_physname + (const char *physname); extern char *method_name_from_physname (const char *physname); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 1fc6d7ffb4f5..aac8f8fa70b5 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -16279,7 +16279,7 @@ guess_full_die_structure_name (struct die_info *die, struct dwarf2_cu *cu) if (linkage_name != NULL) { gdb::unique_xmalloc_ptr actual_name - (cu->language_defn->class_name_from_physname (linkage_name)); + = cu->language_defn->class_name_from_physname (linkage_name); const char *name = NULL; if (actual_name != NULL) diff --git a/gdb/language.h b/gdb/language.h index 5f4f28079a4f..0ca7a030a8b2 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -447,7 +447,8 @@ struct language_defn } /* Return class name of a mangled method name or NULL. */ - virtual char *class_name_from_physname (const char *physname) const + virtual gdb::unique_xmalloc_ptr class_name_from_physname + (const char *physname) const { return nullptr; } base-commit: 91a47f3ae9d6d494b0c794a3ccd81b242bd15b7d -- 2.56.0