aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-07-20 15:06:13 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-07-20 15:06:13 +0000
commitb5758fe446964d9f8d5b31ba2deb6071040b25cf (patch)
tree83815bc6668a2513ec45a2bebfb25b8a5fa47a11
parentec9499be38ba1d887ded89bd2ef63836ad28f220 (diff)
downloadgdb-b5758fe446964d9f8d5b31ba2deb6071040b25cf.zip
gdb-b5758fe446964d9f8d5b31ba2deb6071040b25cf.tar.gz
gdb-b5758fe446964d9f8d5b31ba2deb6071040b25cf.tar.bz2
* dwarf2loc.c (find_location_expression): Retrieve beginning and
ending address offsets in location list entries as integers, not as addresses.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2loc.c24
2 files changed, 21 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9b8e9f9..f07defa 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2009-07-20 Ulrich Weigand <uweigand@de.ibm.com>
+ * dwarf2loc.c (find_location_expression): Retrieve beginning and
+ ending address offsets in location list entries as integers,
+ not as addresses.
+
+2009-07-20 Ulrich Weigand <uweigand@de.ibm.com>
+
* infrun.c (wait_for_inferior): Invalidate registers and overlay
cache every time before calling target_wait.
(handle_inferior_event): Make static. Always reset waiton_ptid.
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index b163231..071b5ac 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -70,22 +70,28 @@ find_location_expression (struct dwarf2_loclist_baton *baton,
while (1)
{
- low = dwarf2_read_address (gdbarch, loc_ptr, buf_end, addr_size);
- loc_ptr += addr_size;
- high = dwarf2_read_address (gdbarch, loc_ptr, buf_end, addr_size);
- loc_ptr += addr_size;
+ if (buf_end - loc_ptr < 2 * addr_size)
+ error (_("find_location_expression: Corrupted DWARF expression."));
- /* An end-of-list entry. */
- if (low == 0 && high == 0)
- return NULL;
+ low = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
+ loc_ptr += addr_size;
/* A base-address-selection entry. */
- if ((low & base_mask) == base_mask)
+ if (low == base_mask)
{
- base_address = high;
+ base_address = dwarf2_read_address (gdbarch,
+ loc_ptr, buf_end, addr_size);
+ loc_ptr += addr_size;
continue;
}
+ high = extract_unsigned_integer (loc_ptr, addr_size, byte_order);
+ loc_ptr += addr_size;
+
+ /* An end-of-list entry. */
+ if (low == 0 && high == 0)
+ return NULL;
+
/* Otherwise, a location expression entry. */
low += base_address;
high += base_address;