Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Cary Coutant <ccoutant@google.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Tom Tromey <tromey@redhat.com>,
	gdb-patches@sourceware.org,        Doug Evans <dje@google.com>
Subject: Re: Regression for .debug_types [Re: [patch] Allow dummy CUs created by incremental linker]
Date: Thu, 20 Oct 2011 19:16:00 -0000	[thread overview]
Message-ID: <CAHACq4p7kdYebtdBNrXbcXpztY8NOn3rs66_21vbGCoae254zA@mail.gmail.com> (raw)
In-Reply-To: <20111020145541.GA31871@host1.jankratochvil.net>

> I did not debug it yet but it is a regression for many testcases iff
> .debug_types are used.

Sorry, this patch fixes the problem. In process_psymtab_comp_unit, if
it was scanning a type unit, it was adjusting the info_ptr after my
check for a 0 abbrev code. It turns out that first_die_offset is also
set too early, so I moved the adjustment into
partial_read_comp_unit_head. Running the tests now, with -gdwarf4
explicitly turned on.

-cary


2011-10-20  Cary Coutant  <ccoutant@google.com>

	* dwarf2read.c (dw2_get_file_names): Move adjustment for type
	section to...
	(partial_read_comp_unit_head): ...here.  Add is_debug_type_section
	flag.  Adjust all callers.
	(process_psymtab_comp_unit): Remove adjustment for type section.


Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.576
diff -u -p -r1.576 dwarf2read.c
--- dwarf2read.c	20 Oct 2011 01:11:34 -0000	1.576
+++ dwarf2read.c	20 Oct 2011 18:40:54 -0000
@@ -1336,7 +1336,8 @@ static gdb_byte *partial_read_comp_unit_
 					      gdb_byte *info_ptr,
 					      gdb_byte *buffer,
 					      unsigned int buffer_size,
-					      bfd *abfd);
+					      bfd *abfd,
+					      int is_debug_type_section);

 static void init_cu_die_reader (struct die_reader_specs *reader,
 				struct dwarf2_cu *cu);
@@ -2307,7 +2308,8 @@ dw2_get_file_names (struct objfile *objf

   info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr,
 					  buffer, buffer_size,
-					  abfd);
+					  abfd,
+					  this_cu->debug_type_section != NULL);

   /* Skip dummy compilation units.  */
   if (info_ptr >= buffer + buffer_size
@@ -2323,8 +2325,6 @@ dw2_get_file_names (struct objfile *objf
   dwarf2_read_abbrevs (abfd, &cu);
   make_cleanup (dwarf2_free_abbrev_table, &cu);

-  if (this_cu->debug_type_section)
-    info_ptr += 8 /*signature*/ + cu.header.offset_size;
   init_cu_die_reader (&reader_specs, &cu);
   read_full_die (&reader_specs, &comp_unit_die, info_ptr,
 		 &has_children);
@@ -2971,7 +2971,7 @@ read_comp_unit_head (struct comp_unit_he
 static gdb_byte *
 partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr,
 			     gdb_byte *buffer, unsigned int buffer_size,
-			     bfd *abfd)
+			     bfd *abfd, int is_debug_type_section)
 {
   gdb_byte *beg_of_comp_unit = info_ptr;

@@ -2979,6 +2979,11 @@ partial_read_comp_unit_head (struct comp

   info_ptr = read_comp_unit_head (header, info_ptr, abfd);

+  /* If we're reading a type unit, skip over the signature and
+     type_offset fields.  */
+  if (is_debug_type_section)
+    info_ptr += 8 /*signature*/ + header->offset_size;
+
   header->first_die_offset = info_ptr - beg_of_comp_unit;

   if (header->version != 2 && header->version != 3 && header->version != 4)
@@ -3372,7 +3377,8 @@ process_psymtab_comp_unit (struct objfil

   info_ptr = partial_read_comp_unit_head (&cu.header, info_ptr,
 					  buffer, buffer_size,
-					  abfd);
+					  abfd,
+					  this_cu->debug_type_section != NULL);

   /* Skip dummy compilation units.  */
   if (info_ptr >= buffer + buffer_size
@@ -3407,8 +3413,6 @@ process_psymtab_comp_unit (struct objfil
   make_cleanup (dwarf2_free_abbrev_table, &cu);

   /* Read the compilation unit die.  */
-  if (this_cu->debug_type_section)
-    info_ptr += 8 /*signature*/ + cu.header.offset_size;
   init_cu_die_reader (&reader_specs, &cu);
   info_ptr = read_full_die (&reader_specs, &comp_unit_die, info_ptr,
 			    &has_children);
@@ -3670,7 +3674,7 @@ load_partial_comp_unit (struct dwarf2_pe
       info_ptr = partial_read_comp_unit_head (&cu->header, info_ptr,
 					      dwarf2_per_objfile->info.buffer,
 					      dwarf2_per_objfile->info.size,
-					      abfd);
+					      abfd, 0);

       /* Skip dummy compilation units.  */
       if (info_ptr >= (dwarf2_per_objfile->info.buffer


  reply	other threads:[~2011-10-20 18:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19  0:44 [patch] Allow dummy CUs created by incremental linker Cary Coutant
2011-10-19 15:27 ` Tom Tromey
2011-10-19 15:52   ` Cary Coutant
2011-10-20 15:00     ` Regression for .debug_types [Re: [patch] Allow dummy CUs created by incremental linker] Jan Kratochvil
2011-10-20 19:16       ` Cary Coutant [this message]
2011-10-20 22:35         ` Cary Coutant
2011-10-21  0:00           ` Jan Kratochvil

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=CAHACq4p7kdYebtdBNrXbcXpztY8NOn3rs66_21vbGCoae254zA@mail.gmail.com \
    --to=ccoutant@google.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=tromey@redhat.com \
    /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