diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index 5eea391..f4f3961 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -255,7 +255,7 @@ gdb_test "x/2bd b" "1.*-89" gdb_test "x/2bu b" "1.*167" gdb_test "x/2bo b" "01.*0247" gdb_test "x/2bt b" "00000001.*10100111" -gdb_test_ptr "x/2ba b" "" "" "0x1.*0xffffffa7" "0x1.*0xffffffffffffffa7" +gdb_test_ptr "x/2ba b" "" "" "0x1.*0xa7" "0x1.*0xa7" gdb_test "x/2bc b" "1 '.001'.*-89 '.\[0-9\]*'" gdb_test "x/2bf b" "1.*-89" @@ -264,7 +264,7 @@ gdb_test "x/2hd h" "291.*-22738" gdb_test "x/2hu h" "291.*42798" gdb_test "x/2ho h" "0443.*0123456" gdb_test "x/2ht h" "0000000100100011.*1010011100101110" -gdb_test_ptr "x/2ha h" "" "" "0x123.*0xffffa72e" "0x123.*0xffffffffffffa72e" +gdb_test_ptr "x/2ha h" "" "" "0x123.*0xa72e" "0x123.*0xa72e" gdb_test "x/2hc h" "35 '.'.*46 '.'" gdb_test "x/2hf h" "291.*-22738" @@ -273,7 +273,7 @@ gdb_test "x/2wd w" "19088743.*-1490098887" gdb_test "x/2wu w" "19088743.*2804868409" gdb_test "x/2wo w" "0110642547.*024713562471" gdb_test "x/2wt w" "00000001001000110100010101100111.*10100111001011101110010100111001" -gdb_test_ptr "x/2wa w" "" "" "0x1234567.*0xa72ee539" "0x1234567.*0xffffffffa72ee539" +gdb_test_ptr "x/2wa w" "" "" "0x1234567.*0xa72ee539" "0x1234567.*0xa72ee539" gdb_test "x/2wc w" "103 'g'.*57 '9'" gdb_test "x/2wf w" "2.99881655e-0?38.*-2.42716126e-0?15" diff --git a/gdb/value.c b/gdb/value.c index 91bf49e..0624b90 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2927,7 +2927,13 @@ unpack_pointer (struct type *type, const gdb_byte *valaddr) { /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure whether we want this to be true eventually. */ - return unpack_long (type, valaddr); + LONGEST ret = unpack_long (type, valaddr); + int len = TYPE_LENGTH (type); + if (sizeof (CORE_ADDR) > len && ret < 0) { + /* Don't sign-extend 32-bit pointer. BZ 15121. */ + return ret & ((1UL << (8 * len)) - 1); + } + return ret; }