public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/ctf: pass partial symtab's filename to buildsym_compunit
@ 2022-04-01  1:34 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2022-04-01  1:34 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=89ab947e7fa451380e7fcbb236c600f4ebb14f0a

commit 89ab947e7fa451380e7fcbb236c600f4ebb14f0a
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Thu Mar 31 17:20:19 2022 -0400

    gdb/ctf: pass partial symtab's filename to buildsym_compunit
    
    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

Diff:
---
 gdb/ctfread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 8636692e2e1..7f7e09638a4 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");
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-01  1:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01  1:34 [binutils-gdb] gdb/ctf: pass partial symtab's filename to buildsym_compunit Simon Marchi

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).