public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: gdb-patches@sourceware.org
Subject: [PATCH] gdb: add logging to dwarf2_initialize_objfile
Date: Mon, 15 Mar 2021 13:21:23 -0400	[thread overview]
Message-ID: <20210315172123.2835450-1-simon.marchi@polymtl.ca> (raw)

I added these printouts while working on 27541.  I won't have a fix for
that right now, but I thought that it would be useful to merge them
upstream, as they help understand what happens in that function.

gdb/ChangeLog:

	* dwarf2/read.c (dwarf2_initialize_objfile): Add debug prints.

Change-Id: I790c0d53383327038cb5dd705f74c8c978e0a7ec
---
 gdb/dwarf2/read.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index a4eb92c7d6f9..1187b1837729 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5904,16 +5904,21 @@ dwarf2_initialize_objfile (struct objfile *objfile, dw_index_kind *index_kind)
   dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
   dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
 
+  dwarf_read_debug_printf ("called");
+
   /* If we're about to read full symbols, don't bother with the
      indices.  In this case we also don't care if some other debug
      format is making psymtabs, because they are all about to be
      expanded anyway.  */
   if ((objfile->flags & OBJF_READNOW))
     {
+      dwarf_read_debug_printf ("readnow requested");
+
       /* When using READNOW, the using_index flag (set below) indicates that
 	 PER_BFD was already initialized, when we loaded some other objfile.  */
       if (per_bfd->using_index)
 	{
+	  dwarf_read_debug_printf ("using_index already set");
 	  *index_kind = dw_index_kind::GDB_INDEX;
 	  per_objfile->resize_symtabs ();
 	  return true;
@@ -5946,6 +5951,7 @@ dwarf2_initialize_objfile (struct objfile *objfile, dw_index_kind *index_kind)
      PER_BFD?  */
   if (per_bfd->debug_names_table != nullptr)
     {
+      dwarf_read_debug_printf ("re-using shared debug names table");
       *index_kind = dw_index_kind::DEBUG_NAMES;
       per_objfile->objfile->partial_symtabs = per_bfd->partial_symtabs;
       per_objfile->resize_symtabs ();
@@ -5956,6 +5962,7 @@ dwarf2_initialize_objfile (struct objfile *objfile, dw_index_kind *index_kind)
      PER_BFD?  */
   if (per_bfd->index_table != nullptr)
     {
+      dwarf_read_debug_printf ("re-using shared index table");
       *index_kind = dw_index_kind::GDB_INDEX;
       per_objfile->objfile->partial_symtabs = per_bfd->partial_symtabs;
       per_objfile->resize_symtabs ();
@@ -5968,10 +5975,14 @@ dwarf2_initialize_objfile (struct objfile *objfile, dw_index_kind *index_kind)
      be completed in dwarf2_build_psymtabs, in the standard partial symtabs
      code path.  */
   if (per_bfd->partial_symtabs != nullptr)
-    return false;
+    {
+      dwarf_read_debug_printf ("re-using shared partial symtabs");
+      return false;
+    }
 
   if (dwarf2_read_debug_names (per_objfile))
     {
+      dwarf_read_debug_printf ("found debug names");
       *index_kind = dw_index_kind::DEBUG_NAMES;
       per_objfile->resize_symtabs ();
       return true;
@@ -5981,6 +5992,7 @@ dwarf2_initialize_objfile (struct objfile *objfile, dw_index_kind *index_kind)
 			     get_gdb_index_contents_from_section<struct dwarf2_per_bfd>,
 			     get_gdb_index_contents_from_section<dwz_file>))
     {
+      dwarf_read_debug_printf ("found gdb index from file");
       *index_kind = dw_index_kind::GDB_INDEX;
       per_objfile->resize_symtabs ();
       return true;
@@ -5991,6 +6003,7 @@ dwarf2_initialize_objfile (struct objfile *objfile, dw_index_kind *index_kind)
 			     get_gdb_index_contents_from_cache,
 			     get_gdb_index_contents_from_cache_dwz))
     {
+      dwarf_read_debug_printf ("found gdb index from cache");
       global_index_cache.hit ();
       *index_kind = dw_index_kind::GDB_INDEX;
       per_objfile->resize_symtabs ();
-- 
2.30.1


                 reply	other threads:[~2021-03-15 17:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210315172123.2835450-1-simon.marchi@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@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: 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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).