aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2011-10-09 19:26:44 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2011-10-09 19:26:44 +0000
commit111c64899c7b1811c3a04c711f4a0dc95776eecc (patch)
treeceae0851734071568fa8693459000c13eac48cf1 /gdb/testsuite
parentbb984ff154d9e532deccdb52b3527496852c5930 (diff)
downloadgdb-111c64899c7b1811c3a04c711f4a0dc95776eecc.zip
gdb-111c64899c7b1811c3a04c711f4a0dc95776eecc.tar.gz
gdb-111c64899c7b1811c3a04c711f4a0dc95776eecc.tar.bz2
gdb/
Recognize virtual tail call frames. * Makefile.in (SFILES): Add dwarf2-frame-tailcall.c. (HFILES_NO_SRCDIR): Add dwarf2-frame-tailcall.h. (COMMON_OBS): Add dwarf2-frame-tailcall.o. * dwarf2-frame-tailcall.c: New file. * dwarf2-frame-tailcall.h: New file. * dwarf2-frame.c: Include dwarf2-frame-tailcall.h. (execute_cfa_program): New function comment. Return INSN_PTR. Reset REGS.PREV only after CIE execution. (struct dwarf2_frame_cache): New field tailcall_cache. (dwarf2_frame_cache): New variables entry_pc, entry_cfa_sp_offset, entry_cfa_sp_offset_p and instr. Execute FDE instructions in two parts, try to find entry_cfa_sp_offset. Call dwarf2_tailcall_sniffer_first. (dwarf2_frame_prev_register): Call dwarf2_tailcall_prev_register_first when appropriate. (dwarf2_frame_dealloc_cache): New function. (dwarf2_frame_sniffer): Preinitialize cache by dwarf2_frame_cache. (dwarf2_frame_unwind): Install dwarf2_frame_dealloc_cache. (dwarf2_signal_frame_unwind): Do not install dwarf2_frame_dealloc_cache. (dwarf2_append_unwinders): Add dwarf2_tailcall_frame_unwind. (dwarf2_frame_cfa): Support also dwarf2_tailcall_frame_unwind. * dwarf2loc.c (func_addr_to_tail_call_list) (tailcall_dump, call_sitep, VEC (call_sitep), chain_candidate) (call_site_find_chain_1, call_site_find_chain): New. * dwarf2loc.h (struct call_site_chain): New. (call_site_find_chain): New declaration. * frame.c (get_frame_address_in_block): Support also TAILCALL_FRAME. * frame.h (enum frame_type): New entry TAILCALL_FRAME. * python/py-frame.c (gdbpy_initialize_frames): Add TAILCALL_FRAME. * stack.c (frame_info): Support also TAILCALL_FRAME. gdb/doc/ Recognize virtual tail call frames. * gdb.texinfo (Optimized Code): Add reference to Tail Call Frames. (Tail Call Frames): New node. (Frames In Python): Add gdb.TAILCALL_FRAME. gdb/testsuite/ Recognize virtual tail call frames. * gdb.arch/amd64-entry-value.cc (c, a, b, amb_z, amb_y, amb_x, amb) (amb_b, amb_a): New. (main): Call a and b. * gdb.arch/amd64-entry-value.exp (tailcall: breakhere, tailcall: bt) (tailcall: p i, tailcall: p j, set $sp0=$sp, up, p $sp0 == $sp, frame 3) (p $sp0 + sizeof (void *) == $sp, ambiguous: breakhere, ambiguous: bt): New tests.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog11
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value.cc62
-rw-r--r--gdb/testsuite/gdb.arch/amd64-entry-value.exp28
3 files changed, 101 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 52e544e..ce9800c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,16 @@
2011-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Recognize virtual tail call frames.
+ * gdb.arch/amd64-entry-value.cc (c, a, b, amb_z, amb_y, amb_x, amb)
+ (amb_b, amb_a): New.
+ (main): Call a and b.
+ * gdb.arch/amd64-entry-value.exp (tailcall: breakhere, tailcall: bt)
+ (tailcall: p i, tailcall: p j, set $sp0=$sp, up, p $sp0 == $sp, frame 3)
+ (p $sp0 + sizeof (void *) == $sp, ambiguous: breakhere, ambiguous: bt):
+ New tests.
+
+2011-10-09 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Implement basic support for DW_TAG_GNU_call_site.
* gdb.arch/Makefile.in (EXECUTABLES): Add amd64-entry-value.
* gdb.arch/amd64-entry-value.cc: New file.
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"