diff options
author | Andrew Burgess <aburgess@broadcom.com> | 2013-09-18 14:02:31 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@broadcom.com> | 2013-09-18 14:02:31 +0000 |
commit | e4c6a2c42df650ad28efcb081244d41954d91353 (patch) | |
tree | f34d306eedefd9eadbde3f53696b9814c8ca5b85 | |
parent | 25f686c226fe67017e54670302cd5c040d8a4ae9 (diff) | |
download | fsf-binutils-gdb-e4c6a2c42df650ad28efcb081244d41954d91353.zip fsf-binutils-gdb-e4c6a2c42df650ad28efcb081244d41954d91353.tar.gz fsf-binutils-gdb-e4c6a2c42df650ad28efcb081244d41954d91353.tar.bz2 |
Consistent display of "<optimized out>" for register values.
https://sourceware.org/ml/gdb-patches/2013-08/msg00170.html
gdb/ChangeLog
* infcmd.c (default_print_one_register_info): Add detection of
optimized out values.
(default_print_registers_info): Switch to using
get_frame_register_value.
gdb/testsuite/ChangeLog
* gdb.dwarf2/dw2-reg-undefined.exp: Change pattern for info
register to "<optimized out>", and also print the registers.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/infcmd.c | 18 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp | 28 |
4 files changed, 39 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 49660b4..7ab79da 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2013-09-18 Andrew Burgess <aburgess@broadcom.com> + + * infcmd.c (default_print_one_register_info): Add detection of + optimized out values. + (default_print_registers_info): Switch to using + get_frame_register_value. + 2013-09-18 Markus Metzger <markus.t.metzger@intel.com> * infrun.c (handle_inferior_event): Check if we know the diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 242aac1..e29dcde 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2033,6 +2033,12 @@ default_print_one_register_info (struct ui_file *file, fprintf_filtered (file, "*value not available*\n"); return; } + else if (value_optimized_out (val)) + { + val_print_optimized_out (file); + fprintf_filtered (file, "\n"); + return; + } /* If virtual format is floating, print it that way, and in raw hex. */ @@ -2107,9 +2113,6 @@ default_print_registers_info (struct gdbarch *gdbarch, for (i = 0; i < numregs; i++) { - struct type *regtype; - struct value *val; - /* Decide between printing all regs, non-float / vector regs, or specific reg. */ if (regnum == -1) @@ -2137,16 +2140,9 @@ default_print_registers_info (struct gdbarch *gdbarch, || *(gdbarch_register_name (gdbarch, i)) == '\0') continue; - regtype = register_type (gdbarch, i); - val = allocate_value (regtype); - - /* Get the data in raw format. */ - if (! deprecated_frame_register_read (frame, i, value_contents_raw (val))) - mark_value_bytes_unavailable (val, 0, TYPE_LENGTH (value_type (val))); - default_print_one_register_info (file, gdbarch_register_name (gdbarch, i), - val); + get_frame_register_value (frame, i)); } } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 4074b8c..9ea731c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-09-18 Andrew Burgess <aburgess@broadcom.com> + + * gdb.dwarf2/dw2-reg-undefined.exp: Change pattern for info + register to "<optimized out>", and also print the registers. + 2013-09-18 Pedro Alves <palves@redhat.com> PR server/15967 diff --git a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp index 7b7b4d1..4686648 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-reg-undefined.exp @@ -38,22 +38,34 @@ if ![runto stop_frame] { gdb_test "bt" "#0 (0x\[0-9a-f\]+ in )?stop_frame \[^\r\n\]*\r\n#1 \[^\r\n\]*first_frame \[^\r\n\]*\r\n#2 \[^\r\n\]*main\[^\r\n\]*" \ "backtrace from stop_frame" -set value_pattern "0x\[0-9a-f\]+\\s+\[0-9\]+" -set opt_out_pattern "\\*value not available\\*" - for {set f 0} {$f < 3} {incr f} { if {${f} == 0} { - set pattern_rax_rbx_rcx ${value_pattern} - set pattern_r8_r9 ${value_pattern} + set pattern_rax_rbx_rcx_print "$hex" + set pattern_rax_rbx_rcx_info "$hex\\s+$decimal" + set pattern_r8_r9_print "$hex" + set pattern_r8_r9_info "$hex\\s+$decimal" } else { - set pattern_rax_rbx_rcx ${opt_out_pattern} - set pattern_r8_r9 ${value_pattern} + set pattern_rax_rbx_rcx_print "<optimized out>" + set pattern_rax_rbx_rcx_info "<optimized out>" + set pattern_r8_r9_print "$hex" + set pattern_r8_r9_info "$hex\\s+$decimal" } # Select frame. gdb_test "frame ${f}" "#${f}.*" "Switch to frame ${f}" + gdb_test "p/x \$rax" ".*$pattern_rax_rbx_rcx_print.*" \ + "print \$rax in frame ${f}" + gdb_test "p/x \$rbx" "$pattern_rax_rbx_rcx_print" \ + "print \$rbx in frame ${f}" + gdb_test "p/x \$rcx" "$pattern_rax_rbx_rcx_print" \ + "print \$rcx in frame ${f}" + + gdb_test "p/x \$r8" "$pattern_r8_r9_print" "print \$r8 in frame ${f}" + gdb_test "p/x \$r9" "$pattern_r8_r9_print" "print \$r9 in frame ${f}" + + # Display register values. - gdb_test "info registers rax rbx rcx r8 r9" "rax\\s+${pattern_rax_rbx_rcx}\\s*\r\nrbx\\s+${pattern_rax_rbx_rcx}\\s*\r\nrcx\\s+${pattern_rax_rbx_rcx}\\s*\r\nr8\\s+${pattern_r8_r9}\\s*\r\nr9\\s+${pattern_r8_r9}\\s*" \ + gdb_test "info registers rax rbx rcx r8 r9" "rax\\s+${pattern_rax_rbx_rcx_info}\\s*\r\nrbx\\s+${pattern_rax_rbx_rcx_info}\\s*\r\nrcx\\s+${pattern_rax_rbx_rcx_info}\\s*\r\nr8\\s+${pattern_r8_r9_info}\\s*\r\nr9\\s+${pattern_r8_r9_info}\\s*" \ "Check values of rax, rbx, rcx, r8, r9 in frame ${f}" } |