From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 03C1E3858C83; Mon, 27 Mar 2023 11:37:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03C1E3858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679917044; bh=6BeMc1Pnwh8l1IPlnT5/XFQKeYf4tJRuYU8TlcMkQQk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CVUYSgj8eDt4zHehbWAFR+t52WLRGnmX//KUF66IfaA0gXumgxTQNTSZvox0joi6e PLXysX7UPFZSaDbRWNID46wOyvPxRjLMMqh6P7vCz7l1BzUHk4EjasfZegxEfTmoDj 5GTsU5Hmo1nRiw2gbFI9fQd2X5SbiiKBiEuf26B8= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug symtab/30276] [gdb/symtab] function name is _Dmain instead of "D main" Date: Mon, 27 Mar 2023 11:37:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: symtab X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30276 --- Comment #4 from Tom de Vries --- (In reply to Tom de Vries from comment #2) > (In reply to Tom de Vries from comment #1) > > But I have no idea whether this is correct. Maybe this needs to be han= dled > > somehow in dwarf2_physname instead? >=20 > In dwarf2_physname we do: > ... > dwarf2_physname (name=3D0x364ce9b "D main", die=3D0x35deb80, cu=3D0x2bc90= f0) at > /data/vries/gdb/src/gdb/dwarf2/read.c:7097 > 7097 struct objfile *objfile =3D cu->per_objfile->objfile; > (gdb) n > 7098 const char *retval, *mangled =3D NULL, *canon =3D NULL; > (gdb)=20 > 7099 int need_copy =3D 1; > (gdb)=20 > 7103 if (!die_needs_namespace (die, cu)) > (gdb)=20 > 7106 if (cu->lang () !=3D language_rust) > (gdb)=20 > 7107 mangled =3D dw2_linkage_name (die, cu); > (gdb)=20 > 7111 gdb::unique_xmalloc_ptr demangled; > (gdb)=20 > 7112 if (mangled !=3D NULL) > (gdb)=20 > 7114 if (cu->language_defn->store_sym_names_in_linkage_form_p ()) > (gdb)=20 > 7128 demangled =3D gdb_demangle (mangled, (DMGL_PARAMS | DMG= L_ANSI > (gdb)=20 > 7131 if (demangled) > (gdb)=20 > 7135 canon =3D mangled; > (gdb)=20 > 7136 need_copy =3D 0; > (gdb)=20 > 7140 if (canon =3D=3D NULL || check_physname) > (gdb)=20 > 7168 retval =3D canon; > (gdb)=20 > 7170 if (need_copy) > (gdb)=20 > 7173 return retval; > (gdb) p retval > $8 =3D 0x364cea2 "_Dmain" > ... So, what I understand happens, we try to demangle the symbol using gdb_demangle, but that doesn't work because we're not passing the DMGL_DLAN= G.=20 So also this works: ... diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index c910be875a3..3debc1c1848 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7126,7 +7126,7 @@ dwarf2_physname (const char *name, struct die_info *d= ie, struct dwarf2_cu *cu) the only disadvantage remains the minimal symbol variant `long name(params)' does not have the proper inferior type. */ demangled =3D gdb_demangle (mangled, (DMGL_PARAMS | DMGL_ANSI - | DMGL_RET_DROP)); + | DMGL_RET_DROP | DMGL_DLANG)= ); } if (demangled) canon =3D demangled.get (); ... But that breaks things for c++. --=20 You are receiving this mail because: You are on the CC list for the bug.=