public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: tromey@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  archer-tromey-dwz-multifile: fix latent bug in dw2_find_symbol_file
Date: Thu, 07 Jun 2012 14:58:00 -0000	[thread overview]
Message-ID: <20120607145828.13866.qmail@sourceware.org> (raw)

The branch, archer-tromey-dwz-multifile has been updated
       via  a4d8176f0794a51f6cd53aeccdd7f4a79d7f50b8 (commit)
      from  5f4e62198dddaf44696edca7542fc0b5fbee1bd5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a4d8176f0794a51f6cd53aeccdd7f4a79d7f50b8
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Jun 7 08:58:12 2012 -0600

    fix latent bug in dw2_find_symbol_file

-----------------------------------------------------------------------

Summary of changes:
 gdb/dwarf2read.c |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

First 500 lines of diff:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 6a2556a..d8dfbd3 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2921,12 +2921,34 @@ dw2_expand_symtabs_with_filename (struct objfile *objfile,
     }
 }
 
+/* A helper function for dw2_find_symbol_file that finds the primary
+   file name for a given CU.  This is a die_reader_func.  */
+
+static void
+dw2_get_primary_filename_reader (const struct die_reader_specs *reader,
+				 gdb_byte *info_ptr,
+				 struct die_info *comp_unit_die,
+				 int has_children,
+				 void *data)
+{
+  const char **result_ptr = data;
+  struct dwarf2_cu *cu = reader->cu;
+  struct attribute *attr;
+
+  attr = dwarf2_attr (comp_unit_die, DW_AT_name, cu);
+  if (attr == NULL)
+    *result_ptr = NULL;
+  else
+    *result_ptr = DW_STRING (attr);
+}
+
 static const char *
 dw2_find_symbol_file (struct objfile *objfile, const char *name)
 {
   struct dwarf2_per_cu_data *per_cu;
   offset_type *vec;
   struct quick_file_names *file_data;
+  const char *filename;
 
   dw2_setup (objfile);
 
@@ -2959,12 +2981,17 @@ dw2_find_symbol_file (struct objfile *objfile, const char *name)
   /* vec[0] is the length, which must always be >0.  */
   per_cu = dw2_get_cu (MAYBE_SWAP (vec[1]));
 
-  file_data = dw2_get_file_names (objfile, per_cu);
-  if (file_data == NULL
-      || file_data->num_file_names == 0)
-    return NULL;
+  if (per_cu->v.quick->symtab != NULL)
+    return per_cu->v.quick->symtab->filename;
+
+  if (per_cu->is_debug_types)
+    init_cutu_and_read_dies (per_cu, 0, 0, dw2_get_primary_filename_reader,
+			     &filename);
+  else
+    init_cutu_and_read_dies_simple (per_cu, dw2_get_primary_filename_reader,
+				    &filename);
 
-  return file_data->file_names[file_data->num_file_names - 1];
+  return filename;
 }
 
 static void


hooks/post-receive
--
Repository for Project Archer.


                 reply	other threads:[~2012-06-07 14:58 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=20120607145828.13866.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=archer-commits@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).