# start by listing all functions
gdb_test "record function-call-history /ci 1, +20" [join [list \
- "1\tfun4\tinst 1,3" \
- "2\t fun1\tinst 4,7" \
- "3\tfun4\tinst 8,8" \
- "4\t fun2\tinst 9,11" \
- "5\t fun1\tinst 12,15" \
- "6\t fun2\tinst 16,17" \
- "7\tfun4\tinst 18,18" \
- "8\t fun3\tinst 19,21" \
- "9\t fun1\tinst 22,25" \
- "10\t fun3\tinst 26,26" \
- "11\t fun2\tinst 27,29" \
- "12\t fun1\tinst 30,33" \
- "13\t fun2\tinst 34,35" \
- "14\t fun3\tinst 36,37" \
- "15\tfun4\tinst 38,39" \
+ "1\tmain\tinst 1,1" \
+ "2\t fun4\tinst 2,4" \
+ "3\t fun1\tinst 5,8" \
+ "4\t fun4\tinst 9,9" \
+ "5\t fun2\tinst 10,12" \
+ "6\t fun1\tinst 13,16" \
+ "7\t fun2\tinst 17,18" \
+ "8\t fun4\tinst 19,19" \
+ "9\t fun3\tinst 20,22" \
+ "10\t fun1\tinst 23,26" \
+ "11\t fun3\tinst 27,27" \
+ "12\t fun2\tinst 28,30" \
+ "13\t fun1\tinst 31,34" \
+ "14\t fun2\tinst 35,36" \
+ "15\t fun3\tinst 37,38" \
+ "16\t fun4\tinst 39,40" \
] "\r\n"]
# let's see if we can go back in history
-gdb_test "record goto 18" ".*fun4 \\(\\) at record_goto.c:43.*"
+gdb_test "record goto 19" ".*fun4 \\(\\) at record_goto.c:43.*"
# the function call history should start at the new location
gdb_test "record function-call-history /ci" [join [list \
- "7\tfun4\tinst 18,18" \
- "8\t fun3\tinst 19,21" \
- "9\t fun1\tinst 22,25" \
- ] "\r\n"] "function-call-history from 18 forwards"
+ "8\t fun4\tinst 19,19" \
+ "9\t fun3\tinst 20,22" \
+ "10\t fun1\tinst 23,26" \
+ ] "\r\n"] "function-call-history from 19 forwards"
# the instruction history should start at the new location
gdb_test "record instruction-history" [join [list \
- "18.*" \
"19.*" \
"20.*" \
- ] "\r\n"] "instruction-history from 18 forwards"
+ "21.*" \
+ ] "\r\n"] "instruction-history from 19 forwards"
# let's go to another place in the history
-gdb_test "record goto 26" ".*fun3 \\(\\) at record_goto.c:35.*"
+gdb_test "record goto 27" ".*fun3 \\(\\) at record_goto.c:35.*"
# check the back trace at that location
gdb_test "backtrace" [join [list \
# the function call history should start at the new location
gdb_test "record function-call-history /ci -" [join [list \
- "8\t fun3\tinst 19,21" \
- "9\t fun1\tinst 22,25" \
- "10\t fun3\tinst 26,26\r" \
- ] "\r\n"] "function-call-history from 26 backwards"
+ "9\t fun3\tinst 20,22" \
+ "10\t fun1\tinst 23,26" \
+ "11\t fun3\tinst 27,27" \
+ ] "\r\n"] "function-call-history from 27 backwards"
# the instruction history should start at the new location
gdb_test "record instruction-history -" [join [list \
- "24.*" \
"25.*" \
- "26.*\r" \
- ] "\r\n"] "instruction-history from 26 backwards"
+ "26.*" \
+ "27.*" \
+ ] "\r\n"] "instruction-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.*"
+gdb_test "record goto begin" ".*main \\(\\) at record_goto.c:49.*"
# check that we're filling up the context correctly
gdb_test "record function-call-history /ci -" [join [list \
- "1\tfun4\tinst 1,3" \
- "2\t fun1\tinst 4,7" \
- "3\tfun4\tinst 8,8" \
+ "1\tmain\tinst 1,1" \
+ "2\t fun4\tinst 2,4" \
+ "3\t fun1\tinst 5,8" \
] "\r\n"] "function-call-history from begin backwards"
# check that we're filling up the context correctly
# check that we're filling up the context correctly
gdb_test "record function-call-history /ci -" [join [list \
- "1\tfun4\tinst 1,3" \
- "2\t fun1\tinst 4,7" \
- "3\tfun4\tinst 8,8" \
+ "1\tmain\tinst 1,1" \
+ "2\t fun4\tinst 2,4" \
+ "3\t fun1\tinst 5,8\r" \
] "\r\n"] "function-call-history from 2 backwards"
# check that we're filling up the context correctly
# check that we're filling up the context correctly
gdb_test "record function-call-history /ci" [join [list \
- "13\t fun2\tinst 34,35" \
- "14\t fun3\tinst 36,37" \
- "15\tfun4\tinst 38,39" \
+ "14\t fun2\tinst 35,36" \
+ "15\t fun3\tinst 37,38" \
+ "16\t fun4\tinst 39,40" \
] "\r\n"] "function-call-history from end forwards"
# check that we're filling up the context correctly
gdb_test "record instruction-history" [join [list \
- "37.*" \
"38.*" \
"39.*" \
+ "40.*\r" \
] "\r\n"] "instruction-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.*"
+gdb_test "record goto 39" ".*fun4 \\(\\) at record_goto.c:44.*"
# check that we're filling up the context correctly
gdb_test "record function-call-history /ci" [join [list \
- "13\t fun2\tinst 34,35" \
- "14\t fun3\tinst 36,37" \
- "15\tfun4\tinst 38,39" \
- ] "\r\n"] "function-call-history from 38 forwards"
+ "14\t fun2\tinst 35,36" \
+ "15\t fun3\tinst 37,38" \
+ "16\t fun4\tinst 39,40\r" \
+ ] "\r\n"] "function-call-history from 39 forwards"
# check that we're filling up the context correctly
gdb_test "record instruction-history" [join [list \
- "37.*" \
"38.*" \
"39.*" \
- ] "\r\n"] "instruction-history from 38 forwards"
+ "40.*\r" \
+ ] "\r\n"] "instruction-history from 39 forwards"