public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.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 [thread overview] Message-ID: <bug-30276-4717-I2hjjVaXOv@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-30276-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=30276 --- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> --- (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 handled > > somehow in dwarf2_physname instead? > > In dwarf2_physname we do: > ... > dwarf2_physname (name=0x364ce9b "D main", die=0x35deb80, cu=0x2bc90f0) at > /data/vries/gdb/src/gdb/dwarf2/read.c:7097 > 7097 struct objfile *objfile = cu->per_objfile->objfile; > (gdb) n > 7098 const char *retval, *mangled = NULL, *canon = NULL; > (gdb) > 7099 int need_copy = 1; > (gdb) > 7103 if (!die_needs_namespace (die, cu)) > (gdb) > 7106 if (cu->lang () != language_rust) > (gdb) > 7107 mangled = dw2_linkage_name (die, cu); > (gdb) > 7111 gdb::unique_xmalloc_ptr<char> demangled; > (gdb) > 7112 if (mangled != NULL) > (gdb) > 7114 if (cu->language_defn->store_sym_names_in_linkage_form_p ()) > (gdb) > 7128 demangled = gdb_demangle (mangled, (DMGL_PARAMS | DMGL_ANSI > (gdb) > 7131 if (demangled) > (gdb) > 7135 canon = mangled; > (gdb) > 7136 need_copy = 0; > (gdb) > 7140 if (canon == NULL || check_physname) > (gdb) > 7168 retval = canon; > (gdb) > 7170 if (need_copy) > (gdb) > 7173 return retval; > (gdb) p retval > $8 = 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_DLANG. 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 *die, struct dwarf2_cu *cu) the only disadvantage remains the minimal symbol variant `long name(params)' does not have the proper inferior type. */ demangled = gdb_demangle (mangled, (DMGL_PARAMS | DMGL_ANSI - | DMGL_RET_DROP)); + | DMGL_RET_DROP | DMGL_DLANG)); } if (demangled) canon = demangled.get (); ... But that breaks things for c++. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2023-03-27 11:37 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-27 10:46 [Bug symtab/30276] New: " vries at gcc dot gnu.org 2023-03-27 10:51 ` [Bug symtab/30276] " vries at gcc dot gnu.org 2023-03-27 11:29 ` vries at gcc dot gnu.org 2023-03-27 11:30 ` vries at gcc dot gnu.org 2023-03-27 11:37 ` vries at gcc dot gnu.org [this message] 2023-03-27 11:53 ` vries at gcc dot gnu.org 2023-03-27 15:05 ` tromey at sourceware dot org 2024-03-30 20:07 ` tromey at sourceware dot org 2024-03-30 20:09 ` tromey at sourceware dot org 2024-03-30 20:10 ` tromey at sourceware dot org 2024-04-02 20:06 ` cvs-commit at gcc dot gnu.org 2024-04-02 20:08 ` tromey at sourceware dot org
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=bug-30276-4717-I2hjjVaXOv@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@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: linkBe 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).