This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch v5 20/21] record-btrace: show trace from enable location


The btrace record target shows the branch trace from the location of the first
branch destination.  This is the first BTS records.

After adding incremental updates, we can now add a dummy record for the current
PC when we enable tracing so we show the trace from the location where branch
tracing has been enabled.

Approved-by: Jan Kratochvil.
2013-09-19  Markus Metzger  <markus.t.metzger@intel.com>

    * btrace.c: Include regcache.h.
    (btrace_add_pc): New.
    (btrace_enable): Call btrace_add_pc.
    (btrace_is_empty): New.
    * btrace.h (btrace_is_empty): New.
    * record-btrace.c (require_btrace, record_btrace_info): Call
    btrace_is_empty.

testsuite/
    * gdb.btrace/exception.exp: Update.
    * gdb.btrace/instruction_history.exp: Update.
    * gdb.btrace/record_goto.exp: Update.
    * gdb.btrace/tailcall.exp: Update.
    * gdb.btrace/unknown_functions.exp: Update.
    * gdb.btrace/delta.exp: New.


---
 gdb/btrace.c                                     |   51 +++++++++++
 gdb/btrace.h                                     |    4 +
 gdb/record-btrace.c                              |    8 +-
 gdb/testsuite/gdb.btrace/delta.exp               |   63 ++++++++++++++
 gdb/testsuite/gdb.btrace/exception.exp           |   18 ++--
 gdb/testsuite/gdb.btrace/instruction_history.exp |   78 ++++++++---------
 gdb/testsuite/gdb.btrace/record_goto.exp         |   99 +++++++++++-----------
 gdb/testsuite/gdb.btrace/tailcall.exp            |   16 ++--
 gdb/testsuite/gdb.btrace/unknown_functions.exp   |   22 +++--
 9 files changed, 238 insertions(+), 121 deletions(-)
 create mode 100644 gdb/testsuite/gdb.btrace/delta.exp

diff --git a/gdb/btrace.c b/gdb/btrace.c
index 82cb134..0e9fa05 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -30,6 +30,7 @@
 #include "source.h"
 #include "filenames.h"
 #include "xml-support.h"
+#include "regcache.h"
 
 /* Print a record debug message.  Use do ... while (0) to avoid ambiguities
    when used in if statements.  */
@@ -663,6 +664,32 @@ btrace_compute_ftrace (struct btrace_thread_info *btinfo,
   btinfo->level = -level;
 }
 
+/* Add an entry for the current PC.  */
+
+static void
+btrace_add_pc (struct thread_info *tp)
+{
+  VEC (btrace_block_s) *btrace;
+  struct btrace_block *block;
+  struct regcache *regcache;
+  struct cleanup *cleanup;
+  CORE_ADDR pc;
+
+  regcache = get_thread_regcache (tp->ptid);
+  pc = regcache_read_pc (regcache);
+
+  btrace = NULL;
+  cleanup = make_cleanup (VEC_cleanup (btrace_block_s), &btrace);
+
+  block = VEC_safe_push (btrace_block_s, btrace, NULL);
+  block->begin = pc;
+  block->end = pc;
+
+  btrace_compute_ftrace (&tp->btrace, btrace);
+
+  do_cleanups (cleanup);
+}
+
 /* See btrace.h.  */
 
 void
@@ -677,6 +704,11 @@ btrace_enable (struct thread_info *tp)
   DEBUG ("enable thread %d (%s)", tp->num, target_pid_to_str (tp->ptid));
 
   tp->btrace.target = target_enable_btrace (tp->ptid);
+
+  /* Add an entry for the current PC so we start tracing from where we
+     enabled it.  */
+  if (tp->btrace.target != NULL)
+    btrace_add_pc (tp);
 }
 
 /* See btrace.h.  */
@@ -1452,3 +1484,22 @@ btrace_is_replaying (struct thread_info *tp)
 {
   return tp->btrace.replay != NULL;
 }
+
+/* See btrace.h.  */
+
+int
+btrace_is_empty (struct thread_info *tp)
+{
+  struct btrace_insn_iterator begin, end;
+  struct btrace_thread_info *btinfo;
+
+  btinfo = &tp->btrace;
+
+  if (btinfo->begin == NULL)
+    return 1;
+
+  btrace_insn_begin (&begin, btinfo);
+  btrace_insn_end (&end, btinfo);
+
+  return btrace_insn_cmp (&begin, &end) == 0;
+}
diff --git a/gdb/btrace.h b/gdb/btrace.h
index 66b5967..36e12cb 100644
--- a/gdb/btrace.h
+++ b/gdb/btrace.h
@@ -314,4 +314,8 @@ extern void btrace_set_call_history (struct btrace_thread_info *,
 /* Determine if branch tracing is currently replaying TP.  */
 extern int btrace_is_replaying (struct thread_info *tp);
 
+/* Return non-zero if the branch trace for TP is empty; zero otherwise.  */
+extern int btrace_is_empty (struct thread_info *tp);
+
+
 #endif /* BTRACE_H */
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 7188f9e..9c49959 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -65,7 +65,6 @@ static struct thread_info *
 require_btrace_thread (void)
 {
   struct thread_info *tp;
-  struct btrace_thread_info *btinfo;
 
   DEBUG ("require");
 
@@ -75,9 +74,7 @@ require_btrace_thread (void)
 
   btrace_fetch (tp);
 
-  btinfo = &tp->btrace;
-
-  if (btinfo->begin == NULL)
+  if (btrace_is_empty (tp))
     error (_("No trace."));
 
   return tp;
@@ -239,7 +236,8 @@ record_btrace_info (void)
   calls = 0;
 
   btinfo = &tp->btrace;
-  if (btinfo->begin != NULL)
+
+  if (!btrace_is_empty (tp))
     {
       struct btrace_call_iterator call;
       struct btrace_insn_iterator insn;
diff --git a/gdb/testsuite/gdb.btrace/delta.exp b/gdb/testsuite/gdb.btrace/delta.exp
new file mode 100644
index 0000000..9ee2629
--- /dev/null
+++ b/gdb/testsuite/gdb.btrace/delta.exp
@@ -0,0 +1,63 @@
+# This testcase is part of GDB, the GNU debugger.
+#
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <markus.t.metzger@intel.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# check for btrace support
+if { [skip_btrace_tests] } { return -1 }
+
+# start inferior
+standard_testfile x86-record_goto.S
+if [prepare_for_testing delta.exp $testfile $srcfile] {
+    return -1
+}
+if ![runto_main] {
+    return -1
+}
+
+# proceed to some sequential code
+gdb_test "next"
+
+# start tracing
+gdb_test_no_output "record btrace"
+
+# we start without trace
+gdb_test "info record" "
+Active record target: record-btrace\r
+Recorded 0 instructions in 0 functions for .*" "delta, 1.1"
+gdb_test "record instruction-history" "No trace\." "delta, 1.2"
+gdb_test "record function-call-history" "No trace\." "delta, 1.3"
+
+# we record each single-step, even if we have not seen a branch, yet.
+gdb_test "stepi"
+
+gdb_test "info record" "
+Active record target: record-btrace\r
+Recorded 1 instructions in 1 functions for .*" "delta, 3.1"
+gdb_test "record instruction-history /f 1" "
+1\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tmov *\\\$0x0,%eax\r" "delta, 3.2"
+gdb_test "record function-call-history /c 1" "
+1\tmain\r" "delta, 3.3"
+
+# make sure we don't extend the trace when we ask again.
+gdb_test "info record" "
+Active record target: record-btrace\r
+Recorded 1 instructions in 1 functions for .*" "delta, 4.1"
+gdb_test "record instruction-history /f 1" "
+1\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tmov *\\\$0x0,%eax\r" "delta, 4.2"
+gdb_test "record function-call-history /c 1" "
+1\tmain\r" "delta, 4.3"
diff --git a/gdb/testsuite/gdb.btrace/exception.exp b/gdb/testsuite/gdb.btrace/exception.exp
index cc21574..3283d5a 100755
--- a/gdb/testsuite/gdb.btrace/exception.exp
+++ b/gdb/testsuite/gdb.btrace/exception.exp
@@ -46,10 +46,11 @@ gdb_continue_to_breakpoint "cont to bp.2" ".*$srcfile:$bp_2\r\n.*"
 # show the flat branch trace
 send_gdb "record function-call-history 1\n"
 gdb_expect_list "exception - flat" "\r\n$gdb_prompt $" {"\r
-1\ttest\\(\\)\r
-2\tfoo\\(\\)\r
-3\tbar\\(\\)\r
-4\tbad\\(\\)\r" "\r
+1\tmain\\(\\)\r
+2\ttest\\(\\)\r
+3\tfoo\\(\\)\r
+4\tbar\\(\\)\r
+5\tbad\\(\\)\r" "\r
 \[0-9\]*\ttest\\(\\)"}
 
 # show the branch trace with calls indented
@@ -58,8 +59,9 @@ gdb_expect_list "exception - flat" "\r\n$gdb_prompt $" {"\r
 # two leading spaces instead of level 0 without leading spaces.
 send_gdb "record function-call-history /c 1\n"
 gdb_expect_list "exception - calls indented" "\r\n$gdb_prompt $" {"\r
-1\t  test\\(\\)\r
-2\t    foo\\(\\)\r
-3\t      bar\\(\\)\r
-4\t        bad\\(\\)\r" "\r
+1\tmain\\(\\)\r
+2\t  test\\(\\)\r
+3\t    foo\\(\\)\r
+4\t      bar\\(\\)\r
+5\t        bad\\(\\)\r" "\r
 \[0-9\]*\t  test\\(\\)"}
diff --git a/gdb/testsuite/gdb.btrace/instruction_history.exp b/gdb/testsuite/gdb.btrace/instruction_history.exp
index edf529c..90bdc3f 100644
--- a/gdb/testsuite/gdb.btrace/instruction_history.exp
+++ b/gdb/testsuite/gdb.btrace/instruction_history.exp
@@ -56,45 +56,45 @@ gdb_test_multiple "info record" $testname {
     }
 }
 
-# we have exactly 6 instructions here
-set message "exactly 6 instructions"
-if { $traced != 6 } {
+# we have exactly 11 instructions here
+set message "exactly 11 instructions"
+if { $traced != 11 } {
     fail $message
 } else {
     pass $message
 }
 
 # test that we see the expected instructions
-gdb_test "record instruction-history 2,6" "
-2\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
-3\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec    %eax\r
-4\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp    0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
-5\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp    \\\$0x0,%eax\r
-6\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
-
-gdb_test "record instruction-history /f 2,+5" "
-2\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
-3\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec    %eax\r
-4\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp    0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
-5\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp    \\\$0x0,%eax\r
-6\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
-
-gdb_test "record instruction-history /p 6,-5" "
-2\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
-3\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec    %eax\r
-4\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp    0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
-5\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp    \\\$0x0,%eax\r
-6\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
-
-gdb_test "record instruction-history /pf 2,6" "
-2\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
-3\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec    %eax\r
-4\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp    0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
-5\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp    \\\$0x0,%eax\r
-6\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
-
-gdb_test "record instruction-history 2,2" "
-2\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
+gdb_test "record instruction-history 3,7" "
+3\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
+4\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec    %eax\r
+5\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp    0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
+6\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp    \\\$0x0,%eax\r
+7\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
+
+gdb_test "record instruction-history /f 3,+5" "
+3\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
+4\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec    %eax\r
+5\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp    0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
+6\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp    \\\$0x0,%eax\r
+7\t   0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
+
+gdb_test "record instruction-history /p 7,-5" "
+3\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
+4\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tdec    %eax\r
+5\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tjmp    0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
+6\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tcmp    \\\$0x0,%eax\r
+7\t0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
+
+gdb_test "record instruction-history /pf 3,7" "
+3\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
+4\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tdec    %eax\r
+5\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tjmp    0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r
+6\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tcmp    \\\$0x0,%eax\r
+7\t0x\[0-9a-f\]+ <\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
+
+gdb_test "record instruction-history 3,3" "
+3\t   0x\[0-9a-f\]+ <loop\\+\[0-9\]+>:\tje     0x\[0-9a-f\]+ <loop\\+\[0-9\]+>\r"
 
 # the following tests are checking the iterators
 # to avoid lots of regexps, we just check the number of lines that
@@ -137,7 +137,7 @@ if { $traced != $lines } {
 }
 
 # test that the iterator works
-set history_size 3
+set history_size 4
 gdb_test_no_output "set record instruction-history-size $history_size"
 set message "browse history forward start"
 set lines [test_lines_length "record instruction-history 1" $message]
@@ -147,8 +147,6 @@ if { $lines != $history_size } {
     pass $message
 }
 
-set history_size 2
-gdb_test_no_output "set record instruction-history-size $history_size"
 set message "browse history forward middle"
 set lines [test_lines_length "record instruction-history +" $message]
 if { $lines != $history_size } {
@@ -159,7 +157,7 @@ if { $lines != $history_size } {
 
 set message "browse history forward last"
 set lines [test_lines_length "record instruction-history +" $message]
-if { $lines != 1 } {
+if { $lines != 3 } {
     fail $message
 } else {
     pass $message
@@ -170,8 +168,6 @@ gdb_test "record instruction-history" "At the end of the branch trace record\\."
 # make sure we cannot move further
 gdb_test "record instruction-history" "At the end of the branch trace record\\." "browse history forward beyond 2"
 
-set history_size 3
-gdb_test_no_output "set record instruction-history-size $history_size"
 set message "browse history backward last"
 set lines [test_lines_length "record instruction-history -" $message]
 if { $lines != $history_size } {
@@ -180,8 +176,6 @@ if { $lines != $history_size } {
     pass $message
 }
 
-set history_size 2
-gdb_test_no_output "set record instruction-history-size $history_size"
 set message "browse history backward middle"
 set lines [test_lines_length "record instruction-history -" $message]
 if { $lines != $history_size } {
@@ -192,7 +186,7 @@ if { $lines != $history_size } {
 
 set message "browse history backward first"
 set lines [test_lines_length "record instruction-history -" $message]
-if { $lines != 1 } {
+if { $lines != 3 } {
     fail $message
 } else {
     pass $message
diff --git a/gdb/testsuite/gdb.btrace/record_goto.exp b/gdb/testsuite/gdb.btrace/record_goto.exp
index 27c579b..12fabda 100644
--- a/gdb/testsuite/gdb.btrace/record_goto.exp
+++ b/gdb/testsuite/gdb.btrace/record_goto.exp
@@ -50,48 +50,49 @@ gdb_test "next"
 
 # start by listing all functions
 gdb_test "record function-call-history /ci 1, +20" "
-1\t  fun4\tinst 1,3\r
-2\t    fun1\tinst 4,7\r
-3\t  fun4\tinst 8,8\r
-4\t    fun2\tinst 9,11\r
-5\t      fun1\tinst 12,15\r
-6\t    fun2\tinst 16,17\r
-7\t  fun4\tinst 18,18\r
-8\t    fun3\tinst 19,21\r
-9\t      fun1\tinst 22,25\r
-10\t    fun3\tinst 26,26\r
-11\t      fun2\tinst 27,29\r
-12\t        fun1\tinst 30,33\r
-13\t      fun2\tinst 34,35\r
-14\t    fun3\tinst 36,37\r
-15\t  fun4\tinst 38,39\r" "record_goto - list all functions"
+1\tmain\tinst 1,1\r
+2\t  fun4\tinst 2,4\r
+3\t    fun1\tinst 5,8\r
+4\t  fun4\tinst 9,9\r
+5\t    fun2\tinst 10,12\r
+6\t      fun1\tinst 13,16\r
+7\t    fun2\tinst 17,18\r
+8\t  fun4\tinst 19,19\r
+9\t    fun3\tinst 20,22\r
+10\t      fun1\tinst 23,26\r
+11\t    fun3\tinst 27,27\r
+12\t      fun2\tinst 28,30\r
+13\t        fun1\tinst 31,34\r
+14\t      fun2\tinst 35,36\r
+15\t    fun3\tinst 37,38\r
+16\t  fun4\tinst 39,40\r" "record_goto - list all functions"
 
 # let's see if we can go back in history
-gdb_test "record goto 18" "
-.*fun4 \\(\\) at record_goto.c:43.*" "record_goto - goto 18"
+gdb_test "record goto 19" "
+.*fun4 \\(\\) at record_goto.c:43.*" "record_goto - goto 19"
 
 # the function call history should start at the new location
 gdb_test "record function-call-history /ci" "
-7\t  fun4\tinst 18,18\r
-8\t    fun3\tinst 19,21\r
-9\t      fun1\tinst 22,25\r" "record_goto - function-call-history from 18 forwards"
+8\t  fun4\tinst 19,19\r
+9\t    fun3\tinst 20,22\r
+10\t      fun1\tinst 23,26\r" "record_goto - function-call-history from 19 forwards"
 
 # the instruciton history should start at the new location
 gdb_test "record instruction-history" "
-18.*\r
 19.*\r
-20.*\r" "record_goto - instruciton-history from 18 forwards"
+20.*\r
+21.*\r" "record_goto - instruciton-history from 19 forwards"
 
 # let's go to another place in the history
-gdb_test "record goto 26" "
-.*fun3 \\(\\) at record_goto.c:35.*" "record_goto - goto 26"
+gdb_test "record goto 27" "
+.*fun3 \\(\\) at record_goto.c:35.*" "record_goto - goto 27"
 
 # check the back trace at that location
 gdb_test "backtrace" "
 #0.*fun3.*at record_goto.c:35.*\r
 #1.*fun4.*at record_goto.c:44.*\r
 #2.*main.*at record_goto.c:50.*\r
-Backtrace stopped: not enough registers or memory available to unwind further" "backtrace at 25"
+Backtrace stopped: not enough registers or memory available to unwind further" "backtrace at 27"
 
 # walk the backtrace
 gdb_test "up" "
@@ -101,25 +102,25 @@ gdb_test "up" "
 
 # the function call history should start at the new location
 gdb_test "record function-call-history /ci -" "
-8\t    fun3\tinst 19,21\r
-9\t      fun1\tinst 22,25\r
-10\t    fun3\tinst 26,26\r" "record_goto - function-call-history from 26 backwards"
+9\t    fun3\tinst 20,22\r
+10\t      fun1\tinst 23,26\r
+11\t    fun3\tinst 27,27\r" "record_goto - function-call-history from 27 backwards"
 
 # the instruciton history should start at the new location
 gdb_test "record instruction-history -" "
-24.*\r
 25.*\r
-26.*\r" "record_goto - instruciton-history from 26 backwards"
+26.*\r
+27.*\r" "record_goto - instruciton-history from 27 backwards"
 
 # test that we can go to the begin of the trace
 gdb_test "record goto begin" "
-.*fun4 \\(\\) at record_goto.c:40.*" "record_goto - goto begin"
+.*main \\(\\) at record_goto.c:49.*" "record_goto - goto begin"
 
 # check that we're filling up the context correctly
 gdb_test "record function-call-history /ci -" "
-1\t  fun4\tinst 1,3\r
-2\t    fun1\tinst 4,7\r
-3\t  fun4\tinst 8,8\r" "record_goto - function-call-history from begin backwards"
+1\tmain\tinst 1,1\r
+2\t  fun4\tinst 2,4\r
+3\t    fun1\tinst 5,8\r" "record_goto - function-call-history from begin backwards"
 
 # check that we're filling up the context correctly
 gdb_test "record instruction-history -" "
@@ -133,9 +134,9 @@ gdb_test "record goto 2" "
 
 # check that we're filling up the context correctly
 gdb_test "record function-call-history /ci -" "
-1\t  fun4\tinst 1,3\r
-2\t    fun1\tinst 4,7\r
-3\t  fun4\tinst 8,8\r" "record_goto - function-call-history from 2 backwards"
+1\tmain\tinst 1,1\r
+2\t  fun4\tinst 2,4\r
+3\t    fun1\tinst 5,8\r" "record_goto - function-call-history from 2 backwards"
 
 # check that we're filling up the context correctly
 gdb_test "record instruction-history -" "
@@ -149,28 +150,28 @@ gdb_test "record goto end" "
 
 # check that we're filling up the context correctly
 gdb_test "record function-call-history /ci" "
-13\t      fun2\tinst 34,35\r
-14\t    fun3\tinst 36,37\r
-15\t  fun4\tinst 38,39\r" "record_goto - function-call-history from end forwards"
+14\t      fun2\tinst 35,36\r
+15\t    fun3\tinst 37,38\r
+16\t  fun4\tinst 39,40\r" "record_goto - function-call-history from end forwards"
 
 # check that we're filling up the context correctly
 gdb_test "record instruction-history" "
-37.*\r
 38.*\r
-39.*\r" "record_goto - instruciton-history from end forwards"
+39.*\r
+40.*\r" "record_goto - instruciton-history from end forwards"
 
 # we should get the exact same history from the second to last instruction
-gdb_test "record goto 38" "
-.*fun4 \\(\\) at record_goto.c:44.*" "record_goto - goto 38"
+gdb_test "record goto 39" "
+.*fun4 \\(\\) at record_goto.c:44.*" "record_goto - goto 39"
 
 # check that we're filling up the context correctly
 gdb_test "record function-call-history /ci" "
-13\t      fun2\tinst 34,35\r
-14\t    fun3\tinst 36,37\r
-15\t  fun4\tinst 38,39\r" "record_goto - function-call-history from 38 forwards"
+14\t      fun2\tinst 35,36\r
+15\t    fun3\tinst 37,38\r
+16\t  fun4\tinst 39,40\r" "record_goto - function-call-history from 39 forwards"
 
 # check that we're filling up the context correctly
 gdb_test "record instruction-history" "
-37.*\r
 38.*\r
-39.*\r" "record_goto - instruciton-history from 38 forwards"
+39.*\r
+40.*\r" "record_goto - instruciton-history from 39 forwards"
diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp
index 900d731..b9520c4 100644
--- a/gdb/testsuite/gdb.btrace/tailcall.exp
+++ b/gdb/testsuite/gdb.btrace/tailcall.exp
@@ -49,18 +49,20 @@ gdb_test "next"
 
 # show the flat branch trace
 gdb_test "record function-call-history 1" "
-1\tfoo\r
-2\tbar\r
-3\tmain" "tailcall - flat"
+1\tmain\r
+2\tfoo\r
+3\tbar\r
+4\tmain" "tailcall - flat"
 
 # show the branch trace with calls indented
 gdb_test "record function-call-history /c 1" "
-1\t  foo\r
-2\t    bar\r
-3\tmain" "tailcall - calls indented"
+1\tmain\r
+2\t  foo\r
+3\t    bar\r
+4\tmain" "tailcall - calls indented"
 
 # go into bar
-gdb_test "record goto 3" "
+gdb_test "record goto 4" "
 .*bar \\(\\) at .*x86-tailcall.c:24\r\n.*" "go to bar"
 
 # check the backtrace
diff --git a/gdb/testsuite/gdb.btrace/unknown_functions.exp b/gdb/testsuite/gdb.btrace/unknown_functions.exp
index 0c1739f..eee039b 100644
--- a/gdb/testsuite/gdb.btrace/unknown_functions.exp
+++ b/gdb/testsuite/gdb.btrace/unknown_functions.exp
@@ -41,18 +41,20 @@ gdb_continue_to_breakpoint "cont to test" ".*test.*"
 
 # show the flat branch trace
 gdb_test "record function-call-history 1" "
-1\t\\\?\\\?\r
+1\ttest\r
 2\t\\\?\\\?\r
 3\t\\\?\\\?\r
-4\ttest\r
-5\tmain\r
-6\ttest" "unknown - flat"
+4\t\\\?\\\?\r
+5\ttest\r
+6\tmain\r
+7\ttest" "unknown - flat"
 
 # show the branch trace with calls indented
 gdb_test "record function-call-history /c 1" "
-1\t    \\\?\\\?\r
-2\t      \\\?\\\?\r
-3\t    \\\?\\\?\r
-4\t  test\r
-5\tmain\r
-6\t  test" "unknown - calls indented"
+1\t  test\r
+2\t    \\\?\\\?\r
+3\t      \\\?\\\?\r
+4\t    \\\?\\\?\r
+5\t  test\r
+6\tmain\r
+7\t  test" "unknown - calls indented"
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]