From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] gdb/ctf: pass partial symtab's filename to buildsym_compunit
Date: Thu, 31 Mar 2022 17:20:19 -0400 [thread overview]
Message-ID: <20220331212019.2811099-3-simon.marchi@polymtl.ca> (raw)
In-Reply-To: <20220331212019.2811099-1-simon.marchi@polymtl.ca>
I noticed that the CTF symbol reader passes the objfile's name to all
buildsym_compunit instances it creates. The result is that all
compunit_symtabs created have the same name, that of the objfile:
{ objfile /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct objfile *) 0x613000005d00)
{ ((struct compunit_symtab *) 0x621000286760)
debugformat ctf
producer (null)
name libbabeltrace2.so.0.0.0
dirname (null)
blockvector ((struct blockvector *) 0x6210003911d0)
user ((struct compunit_symtab *) (null))
{ symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x6210003911f0)
fullname (null)
linetable ((struct linetable *) 0x0)
}
}
{ ((struct compunit_symtab *) 0x621000275c10)
debugformat ctf
producer (null)
name libbabeltrace2.so.0.0.0
dirname (null)
blockvector ((struct blockvector *) 0x621000286710)
user ((struct compunit_symtab *) (null))
{ symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x621000286730)
fullname (null)
linetable ((struct linetable *) 0x0)
}
}
Notice the two "name libbabeltrace2.so.0.0.0".
Change it to pass the partial_symtab's filename instead. The output
becomes:
{ objfile /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct objfile *) 0x613000005d00)
{ ((struct compunit_symtab *) 0x621000295610)
debugformat ctf
producer (null)
name libbabeltrace2.so.0.0.0
dirname (null)
blockvector ((struct blockvector *) 0x6210003a15d0)
user ((struct compunit_symtab *) (null))
{ symtab /tmp/babeltrace-ctf/src/lib/.libs/libbabeltrace2.so.0.0.0 ((struct symtab *) 0x6210003a15f0)
fullname (null)
linetable ((struct linetable *) 0x0)
}
}
{ ((struct compunit_symtab *) 0x621000288700)
debugformat ctf
producer (null)
name current-thread.c
dirname (null)
blockvector ((struct blockvector *) 0x6210002955c0)
user ((struct compunit_symtab *) (null))
{ symtab /home/simark/src/babeltrace/src/lib/current-thread.c ((struct symtab *) 0x6210002955e0)
fullname (null)
linetable ((struct linetable *) 0x0)
}
}
Note that the first compunit_symtab still has libbabeltrace2.so.0.0.0 as
its name. This is because the CTF symbol reader really creates a
partial symtab named like this. It appears to be because the debug info
contains information that has been factored out of all CUs and is at the
"top-level" of the objfile, outside any real CU. So it creates a
partial symtab and an artificial CU that's named after the objfile.
Change-Id: I576316bab2a3668adf87b4e6cebda900a8159b1b
---
gdb/ctfread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 8636692e2e1b..7f7e09638a40 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -1253,7 +1253,7 @@ ctf_start_symtab (ctf_psymtab *pst,
ccp = &pst->context;
ccp->builder = new buildsym_compunit
- (of, of->original_name, nullptr,
+ (of, pst->filename, nullptr,
language_c, text_offset);
ccp->builder->record_debugformat ("ctf");
}
--
2.35.1
next prev parent reply other threads:[~2022-03-31 21:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 21:20 [PATCH 1/3] gdb/ctf: don't create a buildsym_compunit when building partial symbols Simon Marchi via Gdb-patches
2022-03-31 21:20 ` [PATCH 2/3] gdb: print compunit_symtab name in "maint info symtabs" Simon Marchi via Gdb-patches
2022-03-31 21:20 ` Simon Marchi via Gdb-patches [this message]
2022-04-01 0:07 ` [PATCH 3/3] gdb/ctf: pass partial symtab's filename to buildsym_compunit Wei-min Pan via Gdb-patches
2022-03-31 23:56 ` [PATCH 1/3] gdb/ctf: don't create a buildsym_compunit when building partial symbols Wei-min Pan via Gdb-patches
2022-04-01 0:14 ` Simon Marchi via Gdb-patches
2022-04-01 0:57 ` Wei-min Pan via Gdb-patches
2022-04-01 1:32 ` Simon Marchi via Gdb-patches
2022-04-04 17:08 ` Tom Tromey
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=20220331212019.2811099-3-simon.marchi@polymtl.ca \
--to=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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