From: Daniel Jacobowitz <dan@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Ulrich Weigand <uweigand@de.ibm.com>
Subject: MIPS dwarf2 location lists
Date: Thu, 18 Feb 2010 14:10:00 -0000 [thread overview]
Message-ID: <20100218141036.GA18535@caradoc.them.org> (raw)
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;
next reply other threads:[~2010-02-18 14:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-18 14:10 Daniel Jacobowitz [this message]
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
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=20100218141036.GA18535@caradoc.them.org \
--to=dan@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.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