From 3f39d068e3386ba204a598fa3d2946d357b1d7b2 Mon Sep 17 00:00:00 2001 From: Bernd Edlinger Date: Fri, 14 Feb 2020 20:41:51 +0100 Subject: [PATCH] Fix next-inline test case with step Should stop between inline function invocations. Add -gstatement-frontiers compile option to avoid running test with gcc version that don't support this feature, which would fail the test unnecessarily. Instead make the compile step fail which is less noisy. Add a prefix use_header / no_header to all test cases. gdb: 2020-03-05 Bernd Edlinger * infrun.c (process_event_stop_test): Set step_frame_id. gdb/testsuite: 2020-03-05 Bernd Edlinger * gdb.cp/next-inline.exp: Extend test case. --- gdb/infrun.c | 2 ++ gdb/testsuite/gdb.cp/next-inline.exp | 45 +++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 6c35805..e8221ba 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -7219,6 +7219,8 @@ process_event_stop_test (struct execution_control_state *ecs) ecs->event_thread->control.step_range_start = stop_pc_sal.pc; ecs->event_thread->control.step_range_end = stop_pc_sal.end; ecs->event_thread->control.may_range_step = 1; + ecs->event_thread->control.step_frame_id = get_frame_id (frame); + ecs->event_thread->control.step_stack_frame_id = get_stack_frame_id (frame); if (refresh_step_info) set_step_info (frame, stop_pc_sal); diff --git a/gdb/testsuite/gdb.cp/next-inline.exp b/gdb/testsuite/gdb.cp/next-inline.exp index 0b2b22d..ec04694 100644 --- a/gdb/testsuite/gdb.cp/next-inline.exp +++ b/gdb/testsuite/gdb.cp/next-inline.exp @@ -20,12 +20,16 @@ standard_testfile .cc proc do_test { use_header } { global srcfile testfile - set options {c++ debug nowarnings optimize=-O2} + set options {c++ debug nowarnings optimize=-O2\ -gstatement-frontiers} if { $use_header } { lappend options additional_flags=-DUSE_NEXT_INLINE_H set executable "$testfile-with-header" + set hdrfile "next-inline.h" + set prefix "use_header" } else { set executable "$testfile-no-header" + set hdrfile "$srcfile" + set prefix "no_header" } if { [prepare_for_testing "failed to prepare" $executable \ @@ -33,6 +37,8 @@ proc do_test { use_header } { return -1 } + with_test_prefix $prefix { + if ![runto_main] { fail "can't run to main" return @@ -64,6 +70,43 @@ proc do_test { use_header } { gdb_test "bt" \ "\\s*\\#0\\s+(main|get_alias_set)\[^\r\]*${srcfile}:.*" \ "not in inline 5" + + if {!$use_header} { + return #until that is fixed + } + + if ![runto_main] { + fail "can't run to main pass 2" + return + } + + gdb_test "bt" "\\s*\\#0\\s+main.*" "in main pass 2" + gdb_test "step" ".*" "step into get_alias_set pass 2" + gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \ + "in get_alias_set pass 2" + gdb_test "step" ".*TREE_TYPE.*" "step 1" + gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \ + "not in inline 1 pass 2" + gdb_test "step" ".*if \\(t->x != i\\).*" "step 2" + gdb_test "bt" "\\s*\\#0\\s+\[^\r\]*tree_check\[^\r\]*${hdrfile}:.*" \ + "in inline 1 pass 2" + gdb_test "step" ".*TREE_TYPE.*" "step 3" + gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \ + "not in inline 2 pass 2" + gdb_test "step" ".*if \\(t->x != i\\).*" "step 4" + gdb_test "bt" "\\s*\\#0\\s+\[^\r\]*tree_check\[^\r\]*${hdrfile}:.*" \ + "in inline 2 pass 2" + gdb_test "step" ".*TREE_TYPE.*" "step 5" + gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \ + "not in inline 3 pass 2" + gdb_test "step" ".*if \\(t->x != i\\).*" "step 6" + gdb_test "bt" "\\s*\\#0\\s+\[^\r\]*tree_check\[^\r\]*${hdrfile}:.*" \ + "in inline 3 pass 2" + gdb_test "step" "return 0.*" "step 7" + gdb_test "bt" \ + "\\s*\\#0\\s+(main|get_alias_set)\[^\r\]*${srcfile}:.*" \ + "not in inline 4 pass 2" + } } do_test 0 -- 1.9.1