aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2014-12-28 16:12:53 +0800
committerYao Qi <yao@codesourcery.com>2015-01-08 21:04:00 +0800
commitb597c318b86b5ad2bca1f72ee8c0fbe33cbb7dad (patch)
tree2f53c515cafd11d64b9ec32de0d7e7d0dfa7bb3a /gdb/utils.c
parent3565cf8fedf2bae2b383fae66dde62c3bdae51c9 (diff)
downloadgdb-b597c318b86b5ad2bca1f72ee8c0fbe33cbb7dad.zip
gdb-b597c318b86b5ad2bca1f72ee8c0fbe33cbb7dad.tar.gz
gdb-b597c318b86b5ad2bca1f72ee8c0fbe33cbb7dad.tar.bz2
always read synthetic pointers as signed integers
I see the error message "access outside bounds of object referenced via synthetic pointer" in the two fails below of mips gdb testing print d[-2]^M access outside bounds of object referenced via synthetic pointer^M (gdb) FAIL: gdb.dwarf2/implptrconst.exp: print d[-2] (gdb) print/d p[-1]^M access outside bounds of object referenced via synthetic pointer^M (gdb) FAIL: gdb.dwarf2/implptrpiece.exp: print/d p[-1] in the first test, 'd[-2]' is processed by GDB as '* (&d[-2])'. 'd' is a synthetic pointer, so its value is zero, the address of 'd[-2]' is -2. In dwarf2loc.c:indirect_pieced_value, /* This is an offset requested by GDB, such as value subscripts. However, due to how synthetic pointers are implemented, this is always presented to us as a pointer type. This means we have to sign-extend it manually as appropriate. */ byte_offset = value_as_address (value); if (TYPE_LENGTH (value_type (value)) < sizeof (LONGEST)) byte_offset = gdb_sign_extend (byte_offset, 8 * TYPE_LENGTH (value_type (value))); byte_offset += piece->v.ptr.offset; We know that the value is really an offset instead of address, so the fix is to extract the value as an (signed) offset. gdb: 2015-01-08 Pedro Alves <palves@redhat.com> Yao Qi <yao@codesourcery.com> * dwarf2loc.c (indirect_pieced_value): Don't call gdb_sign_extend. Call extract_signed_integer instead. * utils.c (gdb_sign_extend): Remove. * utils.h (gdb_sign_extend): Remove declaration.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 084db87..72b1e2a 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -3021,23 +3021,6 @@ align_down (ULONGEST v, int n)
return (v & -n);
}
-/* See utils.h. */
-
-LONGEST
-gdb_sign_extend (LONGEST value, int bit)
-{
- gdb_assert (bit >= 1 && bit <= 8 * sizeof (LONGEST));
-
- if (((value >> (bit - 1)) & 1) != 0)
- {
- LONGEST signbit = ((LONGEST) 1) << (bit - 1);
-
- value = (value ^ signbit) - signbit;
- }
-
- return value;
-}
-
/* Allocation function for the libiberty hash table which uses an
obstack. The obstack is passed as DATA. */