diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-10-09 19:29:11 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-10-09 19:29:11 +0000 |
commit | 2d6c5dc2c7f35f46bdbcee6ea442a97ae880db4b (patch) | |
tree | b2564d2dc726b474ab05bf82be51fe330cf227f4 /gdb/testsuite/gdb.arch | |
parent | 111c64899c7b1811c3a04c711f4a0dc95776eecc (diff) | |
download | gdb-2d6c5dc2c7f35f46bdbcee6ea442a97ae880db4b.zip gdb-2d6c5dc2c7f35f46bdbcee6ea442a97ae880db4b.tar.gz gdb-2d6c5dc2c7f35f46bdbcee6ea442a97ae880db4b.tar.bz2 |
gdb/
Protect entry values against self tail calls.
* dwarf2loc.c (VEC (CORE_ADDR), func_verify_no_selftailcall): New.
(dwarf_expr_dwarf_reg_entry_value): Call func_verify_no_selftailcall.
gdb/testsuite/
Protect entry values against self tail calls.
* gdb.arch/amd64-entry-value.cc (self2, self): New.
(main): Call self.
* gdb.arch/amd64-entry-value.exp (self: breakhere, self: bt)
(set debug entry-values 1, self: bt debug entry-values): New tests.
Diffstat (limited to 'gdb/testsuite/gdb.arch')
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-entry-value.cc | 24 | ||||
-rw-r--r-- | gdb/testsuite/gdb.arch/amd64-entry-value.exp | 13 |
2 files changed, 37 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.cc b/gdb/testsuite/gdb.arch/amd64-entry-value.cc index 9e09c8a..44b7564 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.cc +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.cc @@ -91,6 +91,29 @@ amb_a (int i) amb_b (i + 1); } +static void __attribute__((noinline, noclone)) self (int i); + +static void __attribute__((noinline, noclone)) +self2 (int i) +{ + self (i); +} + +static void __attribute__((noinline, noclone)) +self (int i) +{ + if (i == 200) + { + /* GCC would inline `self' as `cmovne' without the `self2' indirect. */ + self2 (i + 1); + } + else + { + e (v, v); + d (i + 2, i + 2.5); + } +} + int main () { @@ -100,5 +123,6 @@ main () else b (5, 5.25); amb_a (100); + self (200); return 0; } diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value.exp b/gdb/testsuite/gdb.arch/amd64-entry-value.exp index 6abc7ab..fdf8040 100644 --- a/gdb/testsuite/gdb.arch/amd64-entry-value.exp +++ b/gdb/testsuite/gdb.arch/amd64-entry-value.exp @@ -73,3 +73,16 @@ 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" + + +# Test self tail calls verification. +# GDB should not print the real value as it is ambiguous. + +gdb_continue_to_breakpoint "self: 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 self \\(i=<optimized out>\\)\[^\r\n\]*\r\n#2 +0x\[0-9a-f\]+ in main \\(\\)\[^\r\n\]*" \ + "self: bt" + +gdb_test_no_output "set debug entry-values 1" +gdb_test "bt" "DW_OP_GNU_entry_value resolving has found function \"self\\(int\\)\" at 0x\[0-9a-f\]+ can call itself via tail calls\r\n.*" \ + "self: bt debug entry-values" |