Move traceframe checking out of traceframe generation

This patch moves traceframe checking code out of traceframe generation,
so that we can generation traceframe once, and do the checking in multiple
times (with target remote, tfile and ctf respectively).  This is a
pure refactor, not functional changes in unavailable.exp.

gdb/testsuite:

2014-05-05  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/unavailable.exp (gdb_collect_args_test): Move some
	code to ...
	(gdb_collect_args_test_1): ... it.  New proc.
	(gdb_collect_locals_test): Move some code to ...
	(gdb_collect_locals_test_1): ... it.  New proc.
	(gdb_unavailable_registers_test): Move some code to ...
	(gdb_unavailable_registers_test_1): ... it.  New proc.
	(gdb_unavailable_floats): Move some code to ...
	(gdb_unavailable_floats_1): ... it.  New proc.
This commit is contained in:
Yao Qi 2014-04-25 16:18:52 +08:00
parent 74183dabc3
commit b5262cd094
2 changed files with 347 additions and 313 deletions

View File

@ -1,3 +1,15 @@
2014-05-05 Yao Qi <yao@codesourcery.com>
* gdb.trace/unavailable.exp (gdb_collect_args_test): Move some
code to ...
(gdb_collect_args_test_1): ... it. New proc.
(gdb_collect_locals_test): Move some code to ...
(gdb_collect_locals_test_1): ... it. New proc.
(gdb_unavailable_registers_test): Move some code to ...
(gdb_unavailable_registers_test_1): ... it. New proc.
(gdb_unavailable_floats): Move some code to ...
(gdb_unavailable_floats_1): ... it. New proc.
2014-05-02 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.arch/amd64-stap-optional-prefix.S (main): Add several

View File

@ -133,19 +133,8 @@ proc test_maybe_regvar_display { var } {
# Test procs
#
proc gdb_collect_args_test {} {
with_test_prefix "unavailable arguments" {
proc gdb_collect_args_test_1 {} {
global cr
global gdb_prompt
prepare_for_trace_test
gdb_test "trace args_test_func" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
# Begin the test.
run_trace_experiment args_test_func
# Test printing the variables, and also their addresses. We
# haven't collected any stack, so there's no way GDB can figure
@ -194,6 +183,22 @@ proc gdb_collect_args_test {} {
gdb_test "info args" "$r" "info args"
test_maybe_regvar_display "argc"
}
proc gdb_collect_args_test {} {
with_test_prefix "unavailable arguments" {
global gdb_prompt
prepare_for_trace_test
gdb_test "trace args_test_func" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
# Begin the test.
run_trace_experiment args_test_func
gdb_collect_args_test_1
gdb_test "tfind none" \
"#0 end .*" \
@ -201,21 +206,8 @@ proc gdb_collect_args_test {} {
}
}
proc gdb_collect_locals_test { func msg } {
with_test_prefix "unavailable locals: $msg" {
proc gdb_collect_locals_test_1 { func } {
global cr
global gdb_prompt
prepare_for_trace_test
set testline [gdb_get_line_number "set $func tracepoint here"]
gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
# Begin the test.
run_trace_experiment $func
gdb_test "print locc" " = <unavailable>"
gdb_test "print loci" " = <unavailable>"
@ -247,6 +239,24 @@ proc gdb_collect_locals_test { func msg } {
gdb_test "info locals" "$r" "info locals"
test_maybe_regvar_display "loci"
}
proc gdb_collect_locals_test { func msg } {
with_test_prefix "unavailable locals: $msg" {
global gdb_prompt
prepare_for_trace_test
set testline [gdb_get_line_number "set $func tracepoint here"]
gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
# Begin the test.
run_trace_experiment $func
gdb_collect_locals_test_1 $func
gdb_test "tfind none" \
"#0 end .*" \
@ -254,24 +264,10 @@ proc gdb_collect_locals_test { func msg } {
}
}
proc gdb_unavailable_registers_test { } {
with_test_prefix "unavailable registers" {
global gdb_prompt
proc gdb_unavailable_registers_test_1 { } {
global spreg
global pcreg
prepare_for_trace_test
# We'll simply re-use the globals_test_function for this test
gdb_test "trace globals_test_func" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
# Collect nothing.
# Begin the test.
run_trace_experiment globals_test_func
# On some archs, the $sp/$pc are a real raw registers. On others,
# like x86, they're user registers. Test both variants.
test_register_unavailable "\$$spreg"
@ -302,15 +298,11 @@ proc gdb_unavailable_registers_test { } {
gdb_test "info registers \$$spreg" \
"<unavailable>" \
"info registers \$$spreg reports not available"
gdb_test "tfind none" "#0 end .*" "cease trace debugging"
}
}
proc gdb_unavailable_floats { } {
global gdb_prompt
proc gdb_unavailable_registers_test { } {
with_test_prefix "unavailable registers" {
with_test_prefix "unavailable floats" {
prepare_for_trace_test
# We'll simply re-use the globals_test_function for this test
@ -323,6 +315,15 @@ proc gdb_unavailable_floats { } {
# Begin the test.
run_trace_experiment globals_test_func
gdb_unavailable_registers_test_1
gdb_test "tfind none" "#0 end .*" "cease trace debugging"
}
}
proc gdb_unavailable_floats_1 { } {
global gdb_prompt
# Necessarily target specific.
if {[istarget "x86_64-*-*"] || [istarget i?86-*]} {
send_gdb "info float\n"
@ -335,58 +336,34 @@ proc gdb_unavailable_floats { } {
"Opcode: <unavailable>"
}
}
}
proc gdb_unavailable_floats { } {
with_test_prefix "unavailable floats" {
prepare_for_trace_test
# We'll simply re-use the globals_test_function for this test
gdb_test "trace globals_test_func" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
# Collect nothing.
# Begin the test.
run_trace_experiment globals_test_func
gdb_unavailable_floats_1
gdb_test "tfind none" "#0 end .*" "cease trace debugging"
}
}
proc gdb_collect_globals_test { } {
with_test_prefix "collect globals" {
proc gdb_collect_globals_test_1 { } {
global ws
global cr
global gdb_prompt
global hex
prepare_for_trace_test
set testline [gdb_get_line_number "set globals_test_func tracepoint here"]
gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
# We collect the initial sizeof(pointer) bytes of derived_partial
# in an attempt of collecting the vptr. Not portable, but should
# work everywhere we need to care.
gdb_trace_setactions "define actions" \
"" \
"collect struct_b.struct_a.array\[2\]" "^$" \
"collect struct_b.struct_a.array\[100\]" "^$" \
\
"collect a" "^$" \
"collect c" "^$" \
\
"collect tarray\[0\].a" "^$" \
"collect tarray\[1\].a" "^$" \
"collect tarray\[3\].a" "^$" \
"collect tarray\[3\].b" "^$" \
"collect tarray\[4\].b" "^$" \
"collect tarray\[5\].b" "^$" \
\
"collect g_string_p" "^$" \
"collect g_string_partial\[1\]" "^$" \
"collect g_string_partial\[2\]" "^$" \
\
"collect g_structref_p" "^$" \
\
"collect *((char *)&derived_partial)@sizeof\(void *\)" "^$" \
"collect derived_whole" "^$" \
\
"collect virtual_partial.z" "^$"
# Begin the test.
run_trace_experiment globals_test_func
gdb_test "print globalc" " = <unavailable>"
gdb_test "print globali" " = <unavailable>"
gdb_test "print globalf" " = <unavailable>"
@ -570,6 +547,51 @@ proc gdb_collect_globals_test { } {
# the vptr.
gdb_test "print virtual_partial" \
" = {_vptr.Virtual = <unavailable>, z = 0}"
}
proc gdb_collect_globals_test { } {
with_test_prefix "collect globals" {
prepare_for_trace_test
set testline [gdb_get_line_number "set globals_test_func tracepoint here"]
gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
# We collect the initial sizeof(pointer) bytes of derived_partial
# in an attempt of collecting the vptr. Not portable, but should
# work everywhere we need to care.
gdb_trace_setactions "define actions" \
"" \
"collect struct_b.struct_a.array\[2\]" "^$" \
"collect struct_b.struct_a.array\[100\]" "^$" \
\
"collect a" "^$" \
"collect c" "^$" \
\
"collect tarray\[0\].a" "^$" \
"collect tarray\[1\].a" "^$" \
"collect tarray\[3\].a" "^$" \
"collect tarray\[3\].b" "^$" \
"collect tarray\[4\].b" "^$" \
"collect tarray\[5\].b" "^$" \
\
"collect g_string_p" "^$" \
"collect g_string_partial\[1\]" "^$" \
"collect g_string_partial\[2\]" "^$" \
\
"collect g_structref_p" "^$" \
\
"collect *((char *)&derived_partial)@sizeof\(void *\)" "^$" \
"collect derived_whole" "^$" \
\
"collect virtual_partial.z" "^$"
# Begin the test.
run_trace_experiment globals_test_func
gdb_collect_globals_test_1
gdb_test "tfind none" \
"#0 end .*" \