diff options
Diffstat (limited to 'gdb/testsuite/gdb.arch')
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-entry-value.cc | 62 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-entry-value.exp | 28 |
2 files changed, 90 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.cc b/gdb/testsuite/gdb.arch/amd64-entry-value.cc index b492231..9e09c8a 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.cc +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.cc @@ -34,9 +34,71 @@ asm ("breakhere:"); e (v, v); } +static void __attribute__((noinline, noclone)) +c (int i, double j) +{ + d (i * 10, j * 10); +} + +static void __attribute__((noinline, noclone)) +a (int i, double j) +{ + c (i + 1, j + 1); +} + +static void __attribute__((noinline, noclone)) +b (int i, double j) +{ + c (i + 2, j + 2); +} + +static void __attribute__((noinline, noclone)) +amb_z (int i) +{ + d (i + 7, i + 7.5); +} + +static void __attribute__((noinline, noclone)) +amb_y (int i) +{ + amb_z (i + 6); +} + +static void __attribute__((noinline, noclone)) +amb_x (int i) +{ + amb_y (i + 5); +} + +static void __attribute__((noinline, noclone)) +amb (int i) +{ + if (i < 0) + amb_x (i + 3); + else + amb_x (i + 4); +} + +static void __attribute__((noinline, noclone)) +amb_b (int i) +{ + amb (i + 2); +} + +static void __attribute__((noinline, noclone)) +amb_a (int i) +{ + amb_b (i + 1); +} + int main () { d (30, 30.5); + if (v) + a (1, 1.25); + else + b (5, 5.25); + amb_a (100); return 0; } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp index e73254b..6abc7ab 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp @@ -45,3 +45,31 @@ gdb_test "bt" "^bt\r\n#0 +d *\\(i=31, j=31\\.5\\) \[^\r\n\]*\r\n#1 +0x\[0-9a-f\] "entry: bt" gdb_test "p i" " = 31" "entry: p i" gdb_test "p j" { = 31\.5} "entry: p j" + + +# 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\]*" \ + "tailcall: bt" +gdb_test "p i" " = 71" "tailcall: p i" +gdb_test "p j" " = 73\\.5" "tailcall: p j" + +# Test $sp simulation for tail call frames. +#gdb_test {p/x $sp} " = 0x.*" +#gdb_test {p/x $pc} " = 0x.*" +gdb_test_no_output {set $sp0=$sp} +gdb_test "up" "\r\n#1 .*" +#gdb_test {p/x $sp} " = 0x.*" +gdb_test {p $sp0 == $sp} " = true" +gdb_test "frame 3" "\r\n#3 .*" +gdb_test {p $sp0 + sizeof (void *) == $sp} " = true" + + +# Test partial-ambiguous virtual tail call frames chain. + +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\]*" \ + "ambiguous: bt" |