diff options
author | Pedro Alves <palves@redhat.com> | 2014-07-22 19:56:28 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-07-22 19:56:28 +0100 |
commit | bddbbedd70665b48d358e457ef122c4df075b76b (patch) | |
tree | 669bfd906f10c89474764ab90ed58f773cdce16d | |
parent | 90a915bf0c95859e90e79c8264825ad6423eea6f (diff) | |
download | gdb-bddbbedd70665b48d358e457ef122c4df075b76b.zip gdb-bddbbedd70665b48d358e457ef122c4df075b76b.tar.gz gdb-bddbbedd70665b48d358e457ef122c4df075b76b.tar.bz2 |
Fix crash on optimized-out entry data values
The tests at
<https://sourceware.org/ml/gdb-patches/2014-07/msg00277.html> show
that comparing a fully optimized out value's contents with a value
that has not been optimized out, or is partially optimized out crashes
GDB:
(gdb) bt
#0 __memcmp_sse4_1 () at ../sysdeps/x86_64/multiarch/memcmp-sse4.S:816
#1 0x00000000005a1914 in memcmp_with_bit_offsets (ptr1=0x202b2f0 "\n", offset1_bits=0, ptr2=0x0, offset2_bits=0, length_bits=32)
at /home/pedro/gdb/mygit/build/../src/gdb/value.c:678
#2 0x00000000005a1a05 in value_available_contents_bits_eq (val1=0x2361ad0, offset1=0, val2=0x23683b0, offset2=0, length=32)
at /home/pedro/gdb/mygit/build/../src/gdb/value.c:717
#3 0x00000000005a1c09 in value_available_contents_eq (val1=0x2361ad0, offset1=0, val2=0x23683b0, offset2=0, length=4)
at /home/pedro/gdb/mygit/build/../src/gdb/value.c:769
#4 0x00000000006033ed in read_frame_arg (sym=0x1b78d20, frame=0x19bca50, argp=0x7fff4aba82b0, entryargp=0x7fff4aba82d0)
at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:416
#5 0x0000000000603abb in print_frame_args (func=0x1b78cb0, frame=0x19bca50, num=-1, stream=0x1aea450) at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:671
#6 0x0000000000604ae8 in print_frame (frame=0x19bca50, print_level=0, print_what=SRC_AND_LOC, print_args=1, sal=...)
at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:1205
#7 0x0000000000604050 in print_frame_info (frame=0x19bca50, print_level=0, print_what=SRC_AND_LOC, print_args=1, set_current_sal=1)
at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:857
#8 0x00000000006029b3 in print_stack_frame (frame=0x19bca50, print_level=0, print_what=SRC_AND_LOC, set_current_sal=1)
at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:169
#9 0x00000000005fc4b8 in print_stop_event (ws=0x7fff4aba8790) at /home/pedro/gdb/mygit/build/../src/gdb/infrun.c:6068
#10 0x00000000005fc830 in normal_stop () at /home/pedro/gdb/mygit/build/../src/gdb/infrun.c:6214
The 'ptr2=0x0' in frame #1 is val2->contents, and since git 4f14910f:
gdb/ChangeLog
2013-11-26 Andrew Burgess <aburgess@broadcom.com>
* value.c (allocate_optimized_out_value): Mark value as non-lazy.
... a fully optimized-out value can have it's value contents buffer
NULL.
As a spotgap fix, revert 4f14910f, with a comment. A full fix would
be too invasive for 7.8.
gdb/
2014-07-22 Pedro Alves <palves@redhat.com>
* value.c (allocate_optimized_out_value): Don't mark value as
non-lazy.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/value.c | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e48ea99..6ce1e52 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-07-22 Pedro Alves <palves@redhat.com> + + * value.c (allocate_optimized_out_value): Don't mark value as + non-lazy. + 2014-07-22 Jiong Wang <jiong.wang@arm.com> * MAINTAINERS (Write After Approval): Update my email address. diff --git a/gdb/value.c b/gdb/value.c index 29abe5f..8b44a6d 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -906,7 +906,10 @@ allocate_optimized_out_value (struct type *type) struct value *retval = allocate_value_lazy (type); set_value_optimized_out (retval, 1); - set_value_lazy (retval, 0); + /* FIXME: we should be able to avoid allocating the value's contents + buffer, but value_available_contents_bits_eq can't handle + that. */ + /* set_value_lazy (retval, 0); */ return retval; } |