Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* MIPS dwarf2 location lists
@ 2010-02-18 14:10 Daniel Jacobowitz
  2010-02-18 16:47 ` Ulrich Weigand
  2010-03-03 19:56 ` [patch, rfc] " Ulrich Weigand
  0 siblings, 2 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2010-02-18 14:10 UTC (permalink / raw)
  To: gdb-patches; +Cc: Ulrich Weigand

Hi Ulrich,

Your patch here:

Subject: [rfc] Fix address vs. offset handling in DWARF-2 location lists
http://sourceware.org/ml/gdb-patches/2009-07/msg00378.html

stopped us from using dwarf2_read_address for the offsets in location
lists.  The comment there talks specifically about MIPS:

  /* For most architectures, calling extract_unsigned_integer() alone
     is sufficient for extracting an address.  However, some
     architectures (e.g. MIPS) use signed addresses and using
     extract_unsigned_integer() will not produce a correct
     result.  Make sure we invoke gdbarch_integer_to_address()
     for those architectures which require it.

This comment does apply to the calls you removed.  GCC typically
generates base_address == 0 and puts the whole address in the
offsets.  Therefore they must be sign extended, and it's
gdbarch_integer_to_address which does that.  So now we're getting
zero-extended addresses, and they don't match anything.

This ties in to my message last night, which was about a different
instance of a similar bug:

Subject: CORE_ADDR representation
http://sourceware.org/ml/gdb/2010-02/msg00118.html

Unlike the place referenced there, however, this is just comparing the
results.  So we have a lot of flexibility; the "abstractly right" fix
would work, but so would a simple mask and check.

Do you have any better idea than the attached?

The tree I'm testing in is not unmodified HEAD; I'm not set up for
that at the moment.  I believe it has a number of other patches
of similar nature to this one.

-- 
Daniel Jacobowitz
CodeSourcery

2010-02-18  Daniel Jacobowitz  <dan@codesourcery.com>

	gdb/
	* dwarf2loc.c (find_location_expression): Mask addresses before
	comparing.

--- gdb-merged-localpatches/gdb/dwarf2loc.c	2010-02-11 12:12:07.000000000 -0800
+++ gdb-merged-postmips/gdb/dwarf2loc.c	2010-02-18 06:05:55.000000000 -0800
@@ -105,7 +105,8 @@ find_location_expression (struct dwarf2_
       length = extract_unsigned_integer (loc_ptr, 2, byte_order);
       loc_ptr += 2;
 
-      if (pc >= low && pc < high)
+      if ((pc & base_mask) >= (low & base_mask)
+	  && (pc & base_mask) < (high & base_mask))
 	{
 	  *locexpr_length = length;
 	  return loc_ptr;


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-06-21 16:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-18 14:10 MIPS dwarf2 location lists Daniel Jacobowitz
2010-02-18 16:47 ` Ulrich Weigand
2010-02-18 17:24   ` Daniel Jacobowitz
2010-02-18 19:20     ` Ulrich Weigand
2010-03-03 19:56 ` [patch, rfc] " Ulrich Weigand
2010-04-09 16:15   ` Ulrich Weigand
2010-04-12 20:24     ` Joel Brobecker
2010-06-11 13:48       ` [patch, rfc, v2] " Ulrich Weigand
2010-06-21 16:53         ` Ulrich Weigand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox