aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-07-25 16:04:53 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-07-25 16:04:53 +0000
commit543305c9cd7417b50b1e6d1fce6c7e0e44741bf4 (patch)
tree9362b4af6cd7e359cf25eef80294b924cd8c249e /gdb
parentc0a91b2b1432c7ecd7dfb558f9c37b6798b234d0 (diff)
downloadgdb-543305c9cd7417b50b1e6d1fce6c7e0e44741bf4.zip
gdb-543305c9cd7417b50b1e6d1fce6c7e0e44741bf4.tar.gz
gdb-543305c9cd7417b50b1e6d1fce6c7e0e44741bf4.tar.bz2
gdb/
Fix implicit pointer offsets. * dwarf2loc.c (indirect_pieced_value): Comment byte_offset. Use also ptr.OFFSET. gdb/testsuite/ Fix implicit pointer offsets. * gdb.dwarf2/implptr.c (add): New marker baz breakpoint. * gdb.dwarf2/implptr.exp (set baz breakpoint for implptr) (continue to breakpoint: continue to baz breakpoint for implptr) (sanity check element 0, sanity check element 1) (enter the inlined function, check element 0 for the offset) (check element 1 for the offset) (continue to breakpoint: ignore the second baz breakpoint): New tests. (set foo breakpoint for implptr): Update the breakpoint number.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarf2loc.c4
-rw-r--r--gdb/testsuite/ChangeLog12
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptr.c2
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptr.exp18
5 files changed, 39 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c90b88f..08361be 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-25 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix implicit pointer offsets.
+ * dwarf2loc.c (indirect_pieced_value): Comment byte_offset. Use also
+ ptr.OFFSET.
+
2011-07-25 Tom Tromey <tromey@redhat.com>
* ada-lang.c (ada_exception_breakpoint_ops): Make return type
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index c29a07c..8ecc688 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1012,6 +1012,8 @@ indirect_pieced_value (struct value *value)
}
frame = get_selected_frame (_("No frame selected."));
+
+ /* This is an offset requested by GDB, such as value subcripts. */
byte_offset = value_as_address (value);
gdb_assert (piece);
@@ -1023,7 +1025,7 @@ indirect_pieced_value (struct value *value)
result = dwarf2_evaluate_loc_desc_full (TYPE_TARGET_TYPE (type), frame,
baton.data, baton.size, baton.per_cu,
- byte_offset);
+ piece->v.ptr.offset + byte_offset);
do_cleanups (back_to);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d448337..622fd58 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,15 @@
+2011-07-25 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix implicit pointer offsets.
+ * gdb.dwarf2/implptr.c (add): New marker baz breakpoint.
+ * gdb.dwarf2/implptr.exp (set baz breakpoint for implptr)
+ (continue to breakpoint: continue to baz breakpoint for implptr)
+ (sanity check element 0, sanity check element 1)
+ (enter the inlined function, check element 0 for the offset)
+ (check element 1 for the offset)
+ (continue to breakpoint: ignore the second baz breakpoint): New tests.
+ (set foo breakpoint for implptr): Update the breakpoint number.
+
2011-07-22 Ulrich Weigand <ulrich.weigand@linaro.org>
* gdb.python/py-mi.exp: Use different file names for different
diff --git a/gdb/testsuite/gdb.dwarf2/implptr.c b/gdb/testsuite/gdb.dwarf2/implptr.c
index 9812b7e..ab68c24 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr.c
+++ b/gdb/testsuite/gdb.dwarf2/implptr.c
@@ -31,7 +31,7 @@ int u[6];
static inline void
add (struct S *a, struct S *b, int c)
{
- *a->x += *b->x;
+ *a->x += *b->x; /* baz breakpoint */
a->y += b->y;
u[c + 0]++;
a = (struct S *) 0;
diff --git a/gdb/testsuite/gdb.dwarf2/implptr.exp b/gdb/testsuite/gdb.dwarf2/implptr.exp
index 562e983..a199a84 100644
--- a/gdb/testsuite/gdb.dwarf2/implptr.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptr.exp
@@ -60,11 +60,26 @@ proc implptr_test_bar {} {
gdb_test "print ***l" " = 5" "print ***l in implptr:bar"
}
+# Test implicit pointer offset.
+proc implptr_test_baz {} {
+ global csrcfile
+ set line [gdb_get_line_number "baz breakpoint" $csrcfile]
+ gdb_test "break implptr.c:$line" "Breakpoint 3.*" \
+ "set baz breakpoint for implptr"
+ gdb_continue_to_breakpoint "continue to baz breakpoint for implptr"
+ gdb_test {p p[0].y} " = 92" "sanity check element 0"
+ gdb_test {p p[1].y} " = 46" "sanity check element 1"
+ gdb_test "step" "\r\nadd \\(.*" "enter the inlined function"
+ gdb_test "p a->y" " = 92" "check element 0 for the offset"
+ gdb_test "p b->y" " = 46" "check element 1 for the offset"
+ gdb_continue_to_breakpoint "ignore the second baz breakpoint"
+}
+
# Test some values in foo.
proc implptr_test_foo {} {
global csrcfile
set line [gdb_get_line_number "foo breakpoint" $csrcfile]
- gdb_test "break implptr.c:$line" "Breakpoint 3.*" \
+ gdb_test "break implptr.c:$line" "Breakpoint 4.*" \
"set foo breakpoint for implptr"
gdb_continue_to_breakpoint "continue to foo breakpoint for implptr"
gdb_test "print p\[0].x" " = \\(int \\*\\) <synthetic pointer>" \
@@ -81,4 +96,5 @@ proc implptr_test_foo {} {
}
implptr_test_bar
+implptr_test_baz
implptr_test_foo