Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: [patch] Fix CU relative vs. absolute offsets  [Re: RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback]
Date: Wed, 07 Mar 2012 17:10:00 -0000	[thread overview]
Message-ID: <20120307170940.GA22619@host2.jankratochvil.net> (raw)
In-Reply-To: <20120305223429.GM2867@adacore.com>

On Mon, 05 Mar 2012 23:34:29 +0100, Joel Brobecker wrote:
> I tested the change, and lo and behold, on x86_64-linux, I get the
> following fixes:
> 
> * gdb.arch:
> +------------+------------+----------------------------------------------------+
> |       FAIL | PASS       | amd64-entry-value.exp: entry: bt                   |

I do not understand how it can happen.  amd64-entry-value.exp uses precompiled
amd64-entry-value.s (unless you use runtest COMPILE=1) and sure it fully
PASSed+PASSes for me.

There are more issues of this kind.

I will re-review the patch later but it seems to me these fixes are needed.

No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu and with
-gdwarf-4 -fdebug-types-section.

It looks as if some of the GDB features have never worked in real world - just
in the testcase which have single CU. :-)


Thanks,
Jan


2012-03-07  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Fix CU relative vs. absolute DIE offsets.
	* dwarf2loc.h (dwarf2_fetch_die_location_block): Rename parameter
	offset to offset_in_cu.
	* dwarf2read.c (process_enumeration_scope): Add CU offset to
	TYPE_OFFSET.
	(dwarf2_fetch_die_location_block): Rename parameter offset to
	offset_in_cu.  New variable offset, add CU offset to OFFSET_IN_CU.

--- a/gdb/dwarf2loc.h
+++ b/gdb/dwarf2loc.h
@@ -61,7 +61,7 @@ const gdb_byte *dwarf2_find_location_expression
    CORE_ADDR pc);
 
 struct dwarf2_locexpr_baton dwarf2_fetch_die_location_block
-  (unsigned int offset, struct dwarf2_per_cu_data *per_cu,
+  (unsigned int offset_in_cu, struct dwarf2_per_cu_data *per_cu,
    CORE_ADDR (*get_frame_pc) (void *baton),
    void *baton);
 
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8031,7 +8031,8 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu)
 	= lookup_signatured_type_at_offset (dwarf2_per_objfile->objfile,
 					    cu->per_cu->debug_types_section,
 					    cu->per_cu->offset);
-      if (type_sig->type_offset != die->offset)
+      if (type_sig->per_cu.offset + type_sig->type_offset
+	  != die->offset)
 	return;
     }
 
@@ -14202,11 +14203,12 @@ follow_die_ref (struct die_info *src_die, struct attribute *attr,
    dwarf2_locexpr_baton->data has lifetime of PER_CU->OBJFILE.  */
 
 struct dwarf2_locexpr_baton
-dwarf2_fetch_die_location_block (unsigned int offset,
+dwarf2_fetch_die_location_block (unsigned int offset_in_cu,
 				 struct dwarf2_per_cu_data *per_cu,
 				 CORE_ADDR (*get_frame_pc) (void *baton),
 				 void *baton)
 {
+  unsigned int offset = per_cu->offset + offset_in_cu;
   struct dwarf2_cu *cu;
   struct die_info *die;
   struct attribute *attr;


  parent reply	other threads:[~2012-03-07 17:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05 22:34 RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback Joel Brobecker
2012-03-06 20:25 ` Tom Tromey
2012-03-06 23:46   ` Joel Brobecker
2012-03-07 17:10 ` Jan Kratochvil [this message]
2012-03-07 17:13   ` [patch 2/2] typedef-checking for CU relative vs. absolute offsets [Re: RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback] Jan Kratochvil
2012-03-07 18:58     ` Doug Evans
2012-03-07 19:10       ` Jan Kratochvil
2012-03-07 19:29         ` Jan Kratochvil
2012-03-08 21:54       ` Tom Tromey
2012-03-08 21:56         ` Doug Evans
2012-03-07 19:07     ` Joel Brobecker
2012-03-07 19:16       ` Jan Kratochvil
2012-03-08 21:53     ` Tom Tromey
2012-03-09 19:40       ` cu_offset vs. sect_offset field names bikeshedding [Re: [patch 2/2] typedef-checking for CU relative vs. absolute offsets] Jan Kratochvil
2012-03-09 19:52         ` Joel Brobecker
2012-03-19 20:02           ` [commit] [patch 2/2] typedef-checking for CU relative vs. absolute offsets Jan Kratochvil
2012-03-09 19:56         ` cu_offset vs. sect_offset field names bikeshedding [Re: [patch 2/2] typedef-checking for CU relative vs. absolute offsets] Tom Tromey
2012-03-07 18:57   ` [patch] Fix CU relative vs. absolute offsets [Re: RFC: problem with DW_OP_GNU_deref_type and dwarf's get_base_type callback] Joel Brobecker
2012-03-07 19:47     ` Joel Brobecker
2012-03-08 19:40       ` [commit] " 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=20120307170940.GA22619@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=brobecker@adacore.com \
    --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