aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-07-11 13:40:24 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-07-11 13:40:24 +0000
commit04ad99e60b4658ff3e7565000b5862c74cce2729 (patch)
tree0ddd26ad0d2f3ca822b0ebcd30cf04749c984d1c /gdb
parent713389e0245333ded5b75dc90583570f8446f508 (diff)
downloadgdb-04ad99e60b4658ff3e7565000b5862c74cce2729.zip
gdb-04ad99e60b4658ff3e7565000b5862c74cce2729.tar.gz
gdb-04ad99e60b4658ff3e7565000b5862c74cce2729.tar.bz2
gdb/
* dwarf2expr.c (read_sleb128): Fix signed extension overflowing host `int'. gdb/testsuite/ * gdb.dwarf2/dw2-const.S (Pointer size): Change from 4 to 8. (DW_AT_high_pc, DW_AT_low_pc): Remove them. (val8, .Ltype_const8, .Ltype_int8, DW_TAG_variable): New. * gdb.dwarf2/dw2-const.exp (print/x val8): New test.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dwarf2expr.c2
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-const.S53
-rw-r--r--gdb/testsuite/gdb.dwarf2/dw2-const.exp1
5 files changed, 54 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 71010f4..4828a3c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwarf2expr.c (read_sleb128): Fix signed extension overflowing host
+ `int'.
+
2011-07-11 Phil Muldoon <pmuldoon@redhat.com>
PR python/12438
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 4522eb8..b23ad9a 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -418,7 +418,7 @@ read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, LONGEST * r)
break;
}
if (shift < (sizeof (*r) * 8) && (byte & 0x40) != 0)
- result |= -(1 << shift);
+ result |= -(((LONGEST) 1) << shift);
*r = result;
return buf;
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index bf29ba0..7c7d562 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-11 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * gdb.dwarf2/dw2-const.S (Pointer size): Change from 4 to 8.
+ (DW_AT_high_pc, DW_AT_low_pc): Remove them.
+ (val8, .Ltype_const8, .Ltype_int8, DW_TAG_variable): New.
+ * gdb.dwarf2/dw2-const.exp (print/x val8): New test.
+
2011-07-11 Phil Muldoon <pmuldoon@redhat.com>
PR python/12438
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-const.S b/gdb/testsuite/gdb.dwarf2/dw2-const.S
index b0622f3..9ff5844 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-const.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-const.S
@@ -37,13 +37,11 @@ func_cu1:
.Lcu1_start:
.2byte 2 /* DWARF Version */
.4byte .Labbrev1_begin /* Offset into abbrev section */
- .byte 4 /* Pointer size */
+ .byte 8 /* Pointer size */
/* CU die */
.uleb128 1 /* Abbrev: DW_TAG_compile_unit */
.4byte .Lline1_begin /* DW_AT_stmt_list */
- .4byte .Lend_text1 /* DW_AT_high_pc */
- .4byte .Lbegin_text1 /* DW_AT_low_pc */
.ascii "file1.txt\0" /* DW_AT_name */
.ascii "GNU C 3.3.3\0" /* DW_AT_producer */
.byte 1 /* DW_AT_language (C) */
@@ -57,6 +55,27 @@ func_cu1:
.uleb128 0x9 /* Abbrev: DW_TAG_const_type */
.4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+ .uleb128 0xa /* Abbrev: DW_TAG_variable */
+ .ascii "val8\0" /* DW_AT_name */
+ .4byte .Ltype_const8-.Lcu1_begin /* DW_AT_type */
+ .byte 2f - 1f /* DW_AT_location */
+1: .byte 0x11 /* DW_OP_consts */
+#if 0 /* gas encodes it explicitly. */
+ .slab128 0xffffffff00000000
+#endif
+#if 0 /* gas encoded it correctly - formed GDB FAILed. */
+ .sleb128 -4294967296
+#endif
+#if 1 /* Rather encode sleb128 by hand. */
+ .byte 0x80, 0x80, 0x80, 0x80, 0x70
+#endif
+ .byte 0x9f /* DW_OP_stack_value */
+2:
+
+.Ltype_const8:
+ .uleb128 0x9 /* Abbrev: DW_TAG_const_type */
+ .4byte .Ltype_int8-.Lcu1_begin /* DW_AT_type */
+
/* func_cu1 */
.uleb128 2 /* Abbrev: DW_TAG_subprogram */
.byte 1 /* DW_AT_external */
@@ -64,8 +83,6 @@ func_cu1:
.byte 2 /* DW_AT_decl_line */
.ascii "func_cu1\0" /* DW_AT_name */
.4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
- .4byte .Lbegin_func_cu1 /* DW_AT_low_pc */
- .4byte .Lend_func_cu1 /* DW_AT_high_pc */
.byte 1 /* DW_AT_frame_base: length */
.byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
@@ -75,6 +92,12 @@ func_cu1:
.byte 4 /* DW_AT_byte_size */
.byte 5 /* DW_AT_encoding */
+.Ltype_int8:
+ .uleb128 3 /* Abbrev: DW_TAG_base_type */
+ .ascii "int8\0" /* DW_AT_name */
+ .byte 8 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
.byte 0 /* End of children of CU */
.Lcu1_end:
@@ -87,10 +110,6 @@ func_cu1:
.byte 1 /* has_children */
.uleb128 0x10 /* DW_AT_stmt_list */
.uleb128 0x6 /* DW_FORM_data4 */
- .uleb128 0x12 /* DW_AT_high_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x11 /* DW_AT_low_pc */
- .uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x25 /* DW_AT_producer */
@@ -113,10 +132,6 @@ func_cu1:
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
- .uleb128 0x11 /* DW_AT_low_pc */
- .uleb128 0x1 /* DW_FORM_addr */
- .uleb128 0x12 /* DW_AT_high_pc */
- .uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x40 /* DW_AT_frame_base */
.uleb128 0xa /* DW_FORM_block1 */
.byte 0x0 /* Terminator */
@@ -154,6 +169,18 @@ func_cu1:
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
+ .uleb128 0xa /* abbrev code */
+ .uleb128 0x34 /* TAG: DW_TAG_variable */
+ .byte 0x0 /* DW_children_no */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .uleb128 0x02 /* DW_AT_location */
+ .uleb128 0xa /* DW_FORM_block1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-const.exp b/gdb/testsuite/gdb.dwarf2/dw2-const.exp
index a0bb89c..da37ce0 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-const.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-const.exp
@@ -39,3 +39,4 @@ clean_restart ${testfile}.x
gdb_test "print twelve" "= 12"
+gdb_test "print/x val8" " = 0xffffffff00000000"