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: the dwz file can contain a .debug_line section
Date: Thu, 07 Jun 2012 14:06:00 -0000	[thread overview]
Message-ID: <20120607140611.29489.qmail@sourceware.org> (raw)

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

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

- Log -----------------------------------------------------------------
commit 5f4e62198dddaf44696edca7542fc0b5fbee1bd5
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Jun 7 08:05:23 2012 -0600

    the dwz file can contain a .debug_line section
    
    fix gdb to read this properly
    fixes a minor latent bug here introduced by fission

commit ce4c7d1657125be1709710315fe03250b2c9878d
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Jun 7 07:46:55 2012 -0600

    fix to always use proper abbrev section

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

Summary of changes:
 gdb/dwarf2read.c |   50 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 40 insertions(+), 10 deletions(-)

First 500 lines of diff:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 30123d3..6a2556a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -583,6 +583,7 @@ struct dwz_file
   struct dwarf2_section_info abbrev;
   struct dwarf2_section_info info;
   struct dwarf2_section_info str;
+  struct dwarf2_section_info line;
   struct dwarf2_section_info macro;
   struct dwarf2_section_info gdb_index;
 
@@ -1779,6 +1780,11 @@ locate_dwz_sections (bfd *abfd, asection *sectp, void *arg)
       dwz_file->str.asection = sectp;
       dwz_file->str.size = bfd_get_section_size (sectp);
     }
+  else if (section_is_p (sectp->name, &dwarf2_elf_names.line))
+    {
+      dwz_file->line.asection = sectp;
+      dwz_file->line.size = bfd_get_section_size (sectp);
+    }
   else if (section_is_p (sectp->name, &dwarf2_elf_names.macro))
     {
       dwz_file->macro.asection = sectp;
@@ -3571,6 +3577,7 @@ create_debug_types_hash_table (struct dwo_file *dwo_file,
     {
       bfd *abfd;
       gdb_byte *info_ptr, *end_ptr;
+      struct dwarf2_section_info *abbrev_section;
 
       dwarf2_read_section (objfile, section);
       info_ptr = section->buffer;
@@ -3582,6 +3589,11 @@ create_debug_types_hash_table (struct dwo_file *dwo_file,
 	 not present, in which case section->asection will be NULL.  */
       abfd = section->asection->owner;
 
+      if (dwo_file)
+	abbrev_section = &dwo_file->sections.abbrev;
+      else
+	abbrev_section = &dwarf2_per_objfile->abbrev;
+
       if (types_htab == NULL)
 	{
 	  if (dwo_file)
@@ -3617,7 +3629,7 @@ create_debug_types_hash_table (struct dwo_file *dwo_file,
 	     table, but we don't need anything else just yet.  */
 
 	  ptr = read_and_check_type_unit_head (&header, section,
-					       &dwo_file->sections.abbrev, ptr,
+					       abbrev_section, ptr,
 					       &signature, &type_offset_in_tu);
 
 	  length = header.initial_length_size + header.length;
@@ -4181,7 +4193,7 @@ init_cutu_and_read_dies_simple (struct dwarf2_per_cu_data *this_cu,
 				void *data)
 {
   init_cutu_and_read_dies_no_follow (this_cu,
-				     &dwarf2_per_objfile->abbrev,
+				     get_abbrev_section_for_cu (this_cu),
 				     NULL,
 				     die_reader_func, data);
 }
@@ -12718,6 +12730,30 @@ add_file_name (struct line_header *lh,
   fe->symtab = NULL;
 }
 
+/* A convenience function to find the proper .debug_line section for a
+   CU.  */
+
+static struct dwarf2_section_info *
+get_debug_line_section (struct dwarf2_cu *cu)
+{
+  struct dwarf2_section_info *section;
+
+  /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the
+     DWO file.  */
+  if (cu->dwo_unit && cu->per_cu->is_debug_types)
+    section = &cu->dwo_unit->dwo_file->sections.line;
+  else if (cu->per_cu->is_dwz)
+    {
+      struct dwz_file *dwz = dwarf2_get_dwz_file ();
+
+      section = &dwz->line;
+    }
+  else
+    section = &dwarf2_per_objfile->line;
+
+  return section;
+}
+
 /* Read the statement program header starting at OFFSET in
    .debug_line, or .debug_line.dwo.  Return a pointer
    to a struct line_header, allocated using xmalloc.
@@ -12738,13 +12774,7 @@ dwarf_decode_line_header (unsigned int offset, struct dwarf2_cu *cu)
   struct dwarf2_section_info *section;
   bfd *abfd;
 
-  /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the
-     DWO file.  */
-  if (cu->dwo_unit && cu->per_cu->is_debug_types)
-    section = &cu->dwo_unit->dwo_file->sections.line;
-  else
-    section = &dwarf2_per_objfile->line;
-
+  section = get_debug_line_section (cu);
   dwarf2_read_section (dwarf2_per_objfile->objfile, section);
   if (section->buffer == NULL)
     {
@@ -13069,7 +13099,7 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
 			 GCd by the linker.  Ignore it.  PR gdb/12528 */
 
 		      long line_offset
-			= line_ptr - dwarf2_per_objfile->line.buffer;
+			= line_ptr - get_debug_line_section (cu)->buffer;
 
 		      complaint (&symfile_complaints,
 				 _(".debug_line address at offset 0x%lx is 0 "


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


                 reply	other threads:[~2012-06-07 14:06 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=20120607140611.29489.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).