diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-10-09 19:34:19 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-10-09 19:34:19 +0000 |
commit | e18b27534c2181c92dc9b685adc05bcf6b685817 (patch) | |
tree | 2098d8656520c417bd086ec4b4e37d601665ea45 /gdb/testsuite/gdb.arch | |
parent | 93d86cefdf1902d003f0d54f27777b8ea4f75b13 (diff) | |
download | gdb-e18b27534c2181c92dc9b685adc05bcf6b685817.zip gdb-e18b27534c2181c92dc9b685adc05bcf6b685817.tar.gz gdb-e18b27534c2181c92dc9b685adc05bcf6b685817.tar.bz2 |
gdb/
Display @entry parameter values (without references).
* dwarf2expr.c (dwarf_block_to_fb_offset, dwarf_block_to_sp_offset):
New functions.
* dwarf2expr.h (dwarf_block_to_fb_offset, dwarf_block_to_sp_offset):
New declarations.
* dwarf2loc.c (dwarf2_find_location_expression): Support location list
entry record.
(dwarf_entry_parameter_to_value, value_of_dwarf_reg_entry)
(value_of_dwarf_block_entry, locexpr_read_variable_at_entry): New
functions.
(dwarf2_locexpr_funcs): Install locexpr_read_variable_at_entry.
(loclist_read_variable_at_entry): New function.
(dwarf2_loclist_funcs): Install loclist_read_variable_at_entry.
* dwarf2read.c (read_call_site_scope): Support also DW_OP_fbreg in
DW_AT_location, call dwarf_block_to_sp_offset for it.
* frame.h (print_entry_values_no, print_entry_values_only)
(print_entry_values_preferred, print_entry_values_if_needed)
(print_entry_values_both, print_entry_values_compact)
(print_entry_values_default, print_entry_values): New declarations.
(struct frame_arg): New field entry_kind.
(read_frame_arg): New parameter entryargp.
* mi/mi-cmd-stack.c (list_arg_or_local): New gdb_assert for
arg->entry_kind. Optionally print the `@entry' suffix.
(list_args_or_locals): New variable entryarg, initialize it.
Initialize also entry_kind of arg and entryarg. Conditionalize
list_arg_or_local for arg, add list_arg_or_local for entryarg. Call
xfree for entryarg.error.
* stack.c (print_entry_values_no, print_entry_values_only)
(print_entry_values_preferred, print_entry_values_if_needed)
(print_entry_values_both, print_entry_values_compact)
(print_entry_values_default, print_entry_values_choices)
(print_entry_values): New variables.
(print_frame_arg): New gdb_assert for arg->entry_kind. Optionally
print the `@entry' suffix, possibly in combination for
print_entry_values_compact.
(read_frame_arg): New parameter entryargp, new variables entryval,
entryval_error and val_equal. Read in also entryargp, respect
print_entry_values, compare the values using val_equal, fill in also
argp->entry_kind (together with entryargp->entry_kind).
(print_frame_args): New variable entryarg, initialize it.
Conditionalize print_frame_arg for arg, add print_frame_arg for
entryarg. Call xfree for entryarg.error.
(_initialize_stack): Call add_setshow_enum_cmd for `entry-values'.
* symtab.h (struct symbol_computed_ops): New field
read_variable_at_entry.
gdb/doc/
Display @entry parameter values (without references).
* gdb.texinfo (Tail Call Frames): Add anchor. Add self tail call
example.
(Print Settings): New description of set print entry-values and show
print entry-values.
gdb/testsuite/
Display @entry parameter values (without references).
* gdb.arch/amd64-entry-value.cc (locexpr, stacktest, data, data2)
(different, validity, invalid): New functions.
(main): Call them.
* gdb.arch/amd64-entry-value.exp: New breakpoints breakhere_locexpr,
stacktest, breakhere_stacktest, different, breakhere_different,
breakhere_validity and breakhere_invalid.
(entry: bt): Update for @entry.
(entry_locexpr: *, entry_stack: *, entry_equal: *, entry_different: *)
(entry_validity: *, entry_invalid: *): Many new tests.
* gdb.base/break.exp
(run until breakpoint set at small function, optimized file): Accept
also the @entry suffix.
* gdb.mi/Makefile.in (PROGS): Add mi2-amd64-entry-value.
* gdb.mi/mi2-amd64-entry-value.c: New files.
* gdb.mi/mi2-amd64-entry-value.exp: New files.
Diffstat (limited to 'gdb/testsuite/gdb.arch')
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-entry-value.cc | 65 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-entry-value.exp | 111 |
2 files changed, 173 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.cc b/gdb/testsuite/gdb.arch/amd64-entry-value.cc index 44b7564..7b7d050 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.cc +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.cc @@ -35,6 +35,13 @@ asm ("breakhere:"); } static void __attribute__((noinline, noclone)) +locexpr (int i) +{ + i = i; +asm ("breakhere_locexpr:"); +} + +static void __attribute__((noinline, noclone)) c (int i, double j) { d (i * 10, j * 10); @@ -114,10 +121,68 @@ self (int i) } } +static void __attribute__((noinline, noclone)) +stacktest (int r1, int r2, int r3, int r4, int r5, int r6, int s1, int s2, + double d1, double d2, double d3, double d4, double d5, double d6, + double d7, double d8, double d9, double da) +{ + s1 = 3; + s2 = 4; + d9 = 3.5; + da = 4.5; + e (v, v); +asm ("breakhere_stacktest:"); + e (v, v); +} + +static int __attribute__((noinline, noclone)) +data (void) +{ + return 10; +} + +static int __attribute__((noinline, noclone)) +data2 (void) +{ + return 20; +} + +static int __attribute__((noinline, noclone)) +different (int val) +{ + val++; + e (val, val); +asm ("breakhere_different:"); + return val; +} + +static int __attribute__((noinline, noclone)) +validity (int lost, int born) +{ + lost = data (); + e (0, 0.0); +asm ("breakhere_validity:"); + return born; +} + +static void __attribute__((noinline, noclone)) +invalid (int inv) +{ + e (0, 0.0); +asm ("breakhere_invalid:"); +} + int main () { d (30, 30.5); + locexpr (30); + stacktest (1, 2, 3, 4, 5, 6, 11, 12, + 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 11.5, 12.5); + different (5); + validity (5, data ()); + invalid (data2 ()); + if (v) a (1, 1.25); else diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp index fdf8040..fcccdd8 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp @@ -35,23 +35,128 @@ if ![runto_main] { } gdb_breakpoint "breakhere" +gdb_breakpoint "breakhere_locexpr" +gdb_breakpoint "stacktest" +gdb_breakpoint "breakhere_stacktest" +gdb_breakpoint "different" +gdb_breakpoint "breakhere_different" +gdb_breakpoint "breakhere_validity" +gdb_breakpoint "breakhere_invalid" # Test @entry values for register passed parameters. gdb_continue_to_breakpoint "entry: breakhere" -gdb_test "bt" "^bt\r\n#0 +d *\\(i=31, j=31\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in main .*" \ +gdb_test "bt" "^bt\r\n#0 +d *\\(i=31, i@entry=30, j=31\\.5, j@entry=30\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in main .*" \ "entry: bt" gdb_test "p i" " = 31" "entry: p i" gdb_test "p j" { = 31\.5} "entry: p j" +# Test @entry values when parameter in function is locexpr (and not loclist). + +gdb_continue_to_breakpoint "entry_locexpr: breakhere_locexpr" +gdb_test "p i" " = 30" "entry_locexpr: p i" +gdb_test_no_output "set variable i = 0" "entry_locexpr: set variable i = 0" +gdb_test "bt" "^bt\r\n#0 +locexpr *\\(i=0, i@entry=30\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in main .*" \ + "entry_locexpr: bt" + + +# Test @entry values for stack passed parameters. + +gdb_continue_to_breakpoint "entry_stack: stacktest" + +gdb_test "bt" "^bt\r\n#0 +stacktest *\\(r1=r1@entry=1, r2=r2@entry=2, \[^\r\n\]+, s1=s1@entry=11, s2=s2@entry=12, \[^\r\n\]+, d9=d9@entry=11\\.5, da=da@entry=12\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in main .*" \ + "entry_stack: bt at entry" + +gdb_continue_to_breakpoint "entry_stack: breakhere_stacktest" + +gdb_test "bt" "^bt\r\n#0 +stacktest *\\(r1=r1@entry=1, r2=r2@entry=2, \[^\r\n\]+, s1=3, s1@entry=11, s2=4, s2@entry=12, \[^\r\n\]+, d9=3\\.5, d9@entry=11\\.5, da=4\\.5, da@entry=12\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in main .*" \ + "entry_stack: bt" + +gdb_test "p s1" " = 3" "entry_stack: p s1" +gdb_test "p s2" " = 4" "entry_stack: p s2" +gdb_test "p d9" " = 3\\.5" "entry_stack: p d9" +gdb_test "p da" " = 4\\.5" "entry_stack: p da" + + +# Test various kinds of `set print entry-values'. + +gdb_continue_to_breakpoint "entry_equal: breakhere" + +gdb_test_no_output "set print entry-values no" "entry_equal: set print entry-values no" +gdb_test "frame" {\(val=5\).*} "entry_equal: frame: no" +gdb_test_no_output "set print entry-values only" "entry_equal: set print entry-values only" +gdb_test "frame" {\(val@entry=5\).*} "entry_equal: frame: only" +gdb_test_no_output "set print entry-values preferred" "entry_equal: set print entry-values preferred" +gdb_test "frame" {\(val@entry=5\).*} "entry_equal: frame: preferred" +gdb_test_no_output "set print entry-values if-needed" "entry_equal: set print entry-values if-needed" +gdb_test "frame" {\(val=5\).*} "entry_equal: frame: if-needed" +gdb_test_no_output "set print entry-values both" "entry_equal: set print entry-values both" +gdb_test "frame" {\(val=5, val@entry=5\).*} "entry_equal: frame: both" +gdb_test_no_output "set print entry-values compact" "entry_equal: set print entry-values compact" +gdb_test "frame" {\(val=val@entry=5\).*} "entry_equal: frame: compact" +gdb_test_no_output "set print entry-values default" "entry_equal: set print entry-values default" +gdb_test "frame" {\(val=val@entry=5\).*} "entry_equal: frame: default" + +gdb_continue_to_breakpoint "entry_different: breakhere" + +gdb_test_no_output "set print entry-values no" "entry_different: set print entry-values no" +gdb_test "frame" {\(val=6\).*} "entry_different: frame: no" +gdb_test_no_output "set print entry-values only" "entry_different: set print entry-values only" +gdb_test "frame" {\(val@entry=5\).*} "entry_different: frame: only" +gdb_test_no_output "set print entry-values preferred" "entry_different: set print entry-values preferred" +gdb_test "frame" {\(val@entry=5\).*} "entry_different: frame: preferred" +gdb_test_no_output "set print entry-values if-needed" "entry_different: set print entry-values if-needed" +gdb_test "frame" {\(val=6\).*} "entry_different: frame: if-needed" +gdb_test_no_output "set print entry-values both" "entry_different: set print entry-values both" +gdb_test "frame" {\(val=6, val@entry=5\).*} "entry_different: frame: both" +gdb_test_no_output "set print entry-values compact" "entry_different: set print entry-values compact" +gdb_test "frame" {\(val=6, val@entry=5\).*} "entry_different: frame: compact" +gdb_test_no_output "set print entry-values default" "entry_different: set print entry-values default" +gdb_test "frame" {\(val=6, val@entry=5\).*} "entry_different: frame: default" + +gdb_continue_to_breakpoint "entry_validity: breakhere" + +gdb_test_no_output "set print entry-values no" "entry_validity: set print entry-values no" +gdb_test "frame" {\(lost=<optimized out>, born=10\).*} "entry_validity: frame: no" +gdb_test_no_output "set print entry-values only" "entry_validity: set print entry-values only" +gdb_test "frame" {\(lost@entry=5, born@entry=<optimized out>\).*} "entry_validity: frame: only" +gdb_test_no_output "set print entry-values preferred" "entry_validity: set print entry-values preferred" +gdb_test "frame" {\(lost@entry=5, born=10\).*} "entry_validity: frame: preferred" +gdb_test_no_output "set print entry-values if-needed" "entry_validity: set print entry-values if-needed" +gdb_test "frame" {\(lost@entry=5, born=10\).*} "entry_validity: frame: if-needed" +gdb_test_no_output "set print entry-values both" "entry_validity: set print entry-values both" +gdb_test "frame" {\(lost=<optimized out>, lost@entry=5, born=10, born@entry=<optimized out>\).*} "entry_validity: frame: both" +gdb_test_no_output "set print entry-values compact" "entry_validity: set print entry-values compact" +gdb_test "frame" {\(lost@entry=5, born=10\).*} "entry_validity: frame: compact" +gdb_test_no_output "set print entry-values default" "entry_validity: set print entry-values default" +gdb_test "frame" {\(lost=<optimized out>, lost@entry=5, born=10\).*} "entry_validity: frame: default" + +gdb_continue_to_breakpoint "entry_invalid: breakhere" + +gdb_test_no_output "set print entry-values no" "entry_invalid: set print entry-values no" +gdb_test "frame" {\(inv=<optimized out>\).*} "entry_invalid: frame: no" +gdb_test_no_output "set print entry-values only" "entry_invalid: set print entry-values only" +gdb_test "frame" {\(inv@entry=<optimized out>\).*} "entry_invalid: frame: only" +gdb_test_no_output "set print entry-values preferred" "entry_invalid: set print entry-values preferred" +gdb_test "frame" {\(inv@entry=<optimized out>\).*} "entry_invalid: frame: preferred" +gdb_test_no_output "set print entry-values if-needed" "entry_invalid: set print entry-values if-needed" +gdb_test "frame" {\(inv=<optimized out>\).*} "entry_invalid: frame: if-needed" +gdb_test_no_output "set print entry-values both" "entry_invalid: set print entry-values both" +gdb_test "frame" {\(inv=<optimized out>, inv@entry=<optimized out>\).*} "entry_invalid: frame: both" +gdb_test_no_output "set print entry-values compact" "entry_invalid: set print entry-values compact" +gdb_test "frame" {\(inv=<optimized out>\).*} "entry_invalid: frame: compact" +gdb_test_no_output "set print entry-values default" "entry_invalid: set print entry-values default" +gdb_test "frame" {\(inv=<optimized out>\).*} "entry_invalid: frame: default" + + # Test virtual tail call frames. gdb_continue_to_breakpoint "tailcall: breakhere" -gdb_test "bt" "^bt\r\n#0 +d *\\(i=71, j=73\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in c \\(i=7, j=7\\.25\\) \[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in b \\(i=5, j=5\\.25\\) \[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in main \[^\r\n\]*" \ +gdb_test "bt" "^bt\r\n#0 +d *\\(i=71, i@entry=70, j=73\\.5, j@entry=72\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in c \\(i=i@entry=7, j=j@entry=7\\.25\\) \[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in b \\(i=i@entry=5, j=j@entry=5\\.25\\) \[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in main \[^\r\n\]*" \ "tailcall: bt" gdb_test "p i" " = 71" "tailcall: p i" gdb_test "p j" " = 73\\.5" "tailcall: p j" @@ -71,7 +176,7 @@ gdb_test {p $sp0 + sizeof (void *) == $sp} " = true" gdb_continue_to_breakpoint "ambiguous: breakhere" -gdb_test "bt" "^bt\r\n#0 +d \\(i=<optimized out>, j=<optimized out>\\)\[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in amb_z \\(i=<optimized out>\\)\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in amb_y \\(i=<optimized out>\\)\[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in amb_x \\(i=<optimized out>\\)\[^\r\n\]*\r\n#4 +0x\[0-9a-f\]+ in amb_b \\(i=101\\)\[^\r\n\]*\r\n#5 +0x\[0-9a-f\]+ in amb_a \\(i=100\\)\[^\r\n\]*\r\n#6 +0x\[0-9a-f\]+ in main \\(\\)\[^\r\n\]*" \ +gdb_test "bt" "^bt\r\n#0 +d \\(i=<optimized out>, j=<optimized out>\\)\[^\r\n\]*\r\n#1 +0x\[0-9a-f\]+ in amb_z \\(i=<optimized out>\\)\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in amb_y \\(i=<optimized out>\\)\[^\r\n\]*\r\n#3 +0x\[0-9a-f\]+ in amb_x \\(i=<optimized out>\\)\[^\r\n\]*\r\n#4 +0x\[0-9a-f\]+ in amb_b \\(i=i@entry=101\\)\[^\r\n\]*\r\n#5 +0x\[0-9a-f\]+ in amb_a \\(i=i@entry=100\\)\[^\r\n\]*\r\n#6 +0x\[0-9a-f\]+ in main \\(\\)\[^\r\n\]*" \ "ambiguous: bt" |