mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 10:03:47 +08:00
[gdb/testsuite] Fix some test-cases for check-read1 (gdb_test_lines)
I ran the testsuite in an environment simulating a stressed system in combination with check-read1. This exposes a few more FAILs. Fix some by using gdb_test_lines, as well as related gdb_get_lines. Tested on x86_64-linux.
This commit is contained in:
parent
be6d665abd
commit
d411083069
@ -80,12 +80,10 @@ gdb_test_multiple "p some_func ()" "" {
|
||||
# debug, to format of which isn't fixed. All we care about is that
|
||||
# GDB is still running afterwards.
|
||||
#
|
||||
# All of the debug output makes this really slow when testing with the
|
||||
# special read1 version of expect, hence the timeout factor.
|
||||
with_read1_timeout_factor 10 {
|
||||
gdb_test_no_output "set debug frame on"
|
||||
gdb_test "p some_func ()" ".*" \
|
||||
"repeat p some_func () with frame debug on"
|
||||
gdb_test_no_output "set debug frame off"
|
||||
}
|
||||
gdb_test_no_output "set debug frame on"
|
||||
gdb_test_lines "p some_func ()" \
|
||||
"repeat p some_func () with frame debug on" \
|
||||
".*"
|
||||
gdb_test_no_output "set debug frame off"
|
||||
|
||||
gdb_test "p 1 + 2 + 3" " = 6"
|
||||
|
@ -64,17 +64,14 @@ gdb_expect_list "flat" "\r\n$gdb_prompt $" [list \
|
||||
]
|
||||
|
||||
# show the branch trace with calls indented
|
||||
send_gdb "record function-call-history /c 1\n"
|
||||
gdb_expect_list "indented" "\r\n$gdb_prompt $" [list \
|
||||
[multi_line \
|
||||
"1\tmain\\(\\)" \
|
||||
"2\t test\\(\\)" \
|
||||
"3\t foo\\(\\)" \
|
||||
"4\t bar\\(\\)" \
|
||||
"5\t bad\\(\\)\r" \
|
||||
] "" \
|
||||
[multi_line \
|
||||
"\[0-9\]*\t test\\(\\)" \
|
||||
"\[0-9\]*\tmain\\(\\)" \
|
||||
] "" \
|
||||
]
|
||||
gdb_test_lines "record function-call-history /c 1" \
|
||||
"indented" \
|
||||
[multi_line \
|
||||
"1\tmain\\(\\)" \
|
||||
"2\t test\\(\\)" \
|
||||
"3\t foo\\(\\)" \
|
||||
"4\t bar\\(\\)" \
|
||||
"5\t bad\\(\\)" \
|
||||
".*" \
|
||||
"$decimal\t test\\(\\)" \
|
||||
"$decimal\tmain\\(\\)"]
|
||||
|
@ -89,42 +89,39 @@ set re_synth "foo & operator=\\(foo const ?&\\);"
|
||||
|
||||
gdb_test "print foo_instance1" "\\$\[0-9\]+ = \{ifoo = 111, ccpfoo = 0x0\}"
|
||||
|
||||
gdb_test_multiple "ptype foo_instance1" "ptype foo_instance1" {
|
||||
-re "type = $re_class${ws}$XX_fields${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
||||
# gcc 2.95.3 -gstabs+, no "const" on "const char *"
|
||||
# TODO: gdb.base/constvar.exp has XFAILed this kind of problem for a
|
||||
# long time, but an XFAIL really needs an external bug report.
|
||||
# -- chastain 2003-12-31
|
||||
# setup_xfail "*-*-*"
|
||||
# fail "ptype foo_instance1"
|
||||
# TODO: this should be a KFAIL.
|
||||
pass "ptype foo_instance1 (shorter match)"
|
||||
}
|
||||
-re "type = $re_class${ws}$re_fields${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
||||
# gcc 2.95.3 -gstabs+ if "const char *" ever gets fixed
|
||||
pass "ptype foo_instance1"
|
||||
}
|
||||
-re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$XX_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
||||
# gcc 3.3.2 -gdwarf-2, "~foo(int)"
|
||||
# TODO: kfail this
|
||||
# kfail "gdb/1113" "ptype foo_instance1"
|
||||
pass "ptype foo_instance1 (shorter match)"
|
||||
}
|
||||
-re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
||||
# gcc 3.3.2 -gdwarf-2, if the dtor bug gets fixed
|
||||
# gcc HEAD -gdwarf-2 (abi-2)
|
||||
# TODO: just pass this
|
||||
pass "ptype foo_instance1 (shorter match)"
|
||||
}
|
||||
-re "type = $re_class${ws}$re_fields${ws}$re_synth${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}$nl$gdb_prompt $" {
|
||||
# gcc 3.3.2 -gstabs+
|
||||
# TODO: enough with the "shorter match"
|
||||
pass "ptype foo_instance1 (shorter match)"
|
||||
}
|
||||
-re "type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods${ws}$re_synth$nl\}$nl$gdb_prompt $" {
|
||||
# gcc HEAD -gstabs+ (abi-2)
|
||||
pass "ptype foo_instance1 (shorter match)"
|
||||
}
|
||||
set lines [gdb_get_lines "ptype foo_instance1"]
|
||||
set test "ptype foo_instance1 output"
|
||||
if { [regexp "^type = $re_class${ws}$XX_fields${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}\r\n$" $lines] } {
|
||||
# gcc 2.95.3 -gstabs+, no "const" on "const char *"
|
||||
# TODO: gdb.base/constvar.exp has XFAILed this kind of problem for a
|
||||
# long time, but an XFAIL really needs an external bug report.
|
||||
# -- chastain 2003-12-31
|
||||
# setup_xfail "*-*-*"
|
||||
# fail "ptype foo_instance1"
|
||||
# TODO: this should be a KFAIL.
|
||||
pass "$test (shorter match)"
|
||||
} elseif { [regexp "^type = $re_class${ws}$re_fields${ws}$re_synth${ws}$re_dtor${ws}$re_ctor${ws}$re_methods$nl\}\r\n$" $lines] } {
|
||||
# gcc 2.95.3 -gstabs+ if "const char *" ever gets fixed
|
||||
pass "$test"
|
||||
} elseif { [regexp "^type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$XX_dtor${ws}$re_methods$nl\}\r\n$" $lines] } {
|
||||
# gcc 3.3.2 -gdwarf-2, "~foo(int)"
|
||||
# TODO: kfail this
|
||||
# kfail "gdb/1113" "ptype foo_instance1"
|
||||
pass "$test (shorter match)"
|
||||
} elseif { [regexp "^type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}\r\n$" $lines] } {
|
||||
# gcc 3.3.2 -gdwarf-2, if the dtor bug gets fixed
|
||||
# gcc HEAD -gdwarf-2 (abi-2)
|
||||
# TODO: just pass this
|
||||
pass "$test (shorter match)"
|
||||
} elseif { [regexp "^type = $re_class${ws}$re_fields${ws}$re_synth${ws}$re_ctor${ws}$re_dtor${ws}$re_methods$nl\}\r\n$" $lines] } {
|
||||
# gcc 3.3.2 -gstabs+
|
||||
# TODO: enough with the "shorter match"
|
||||
pass "$test (shorter match)"
|
||||
} elseif { [regexp "^type = $re_class${ws}$re_fields${ws}$re_ctor${ws}$re_dtor${ws}$re_methods${ws}$re_synth$nl\}\r\n$" $lines] } {
|
||||
# gcc HEAD -gstabs+ (abi-2)
|
||||
pass "$test (shorter match)"
|
||||
} else {
|
||||
fail $test
|
||||
}
|
||||
|
||||
# Print variables and method calls.
|
||||
|
@ -82,11 +82,10 @@ gdb_breakpoint [gdb_get_line_number "Inner test breakpoint"]
|
||||
gdb_continue_to_breakpoint "Inner test breakpoint"
|
||||
|
||||
# Test multiple local blocks.
|
||||
gdb_test "bt full no-filters" \
|
||||
gdb_test_lines "bt full no-filters" "" \
|
||||
".*#0.*end_func.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*"
|
||||
gdb_test "bt full" \
|
||||
".*#0.*cnuf_dne.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*" \
|
||||
"bt full with filters"
|
||||
gdb_test_lines "bt full" "bt full with filters" \
|
||||
".*#0.*cnuf_dne.*h = 9.*f = 42.*g = 19.*bar = $hex \"Inside block x2\".*d = 15.*e = 14.*foo = $hex \"Inside block\".*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*"
|
||||
|
||||
# Test pagination can be aborted even for frame filters.
|
||||
gdb_test_no_output "set height 5" "pagination quit - set height limited"
|
||||
@ -161,15 +160,12 @@ gdb_test "bt -2" \
|
||||
gdb_test "bt 3" \
|
||||
".*#0.*end_func.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\)\[^#\]*More stack frames follow.*" \
|
||||
"bt 3 with frame-filter Reverse disabled"
|
||||
gdb_test "bt no-filter full" \
|
||||
".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*" \
|
||||
"bt no-filters full with Reverse disabled"
|
||||
gdb_test "bt full" \
|
||||
".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*#22.*in func1 \\(\\).*#23.*in func2 \\(f=3\\).*elided = $hex \"Elided frame\".*fb = \{nothing = $hex \"Elided Foo Bar\", f = 84, s = 38\}.*bf = $hex.*" \
|
||||
"bt full with Reverse disabled"
|
||||
gdb_test "bt full hide" \
|
||||
".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*#22.*in func1 \\(\\)\[^#\]*#24.*in func3 \\(i=3\\).*" \
|
||||
"bt full hide with Reverse disabled"
|
||||
gdb_test_lines "bt no-filter full" "bt no-filters full with Reverse disabled" \
|
||||
".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*"
|
||||
gdb_test_lines "bt full" "bt full with Reverse disabled" \
|
||||
".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*#22.*in func1 \\(\\).*#23.*in func2 \\(f=3\\).*elided = $hex \"Elided frame\".*fb = \{nothing = $hex \"Elided Foo Bar\", f = 84, s = 38\}.*bf = $hex.*"
|
||||
gdb_test_lines "bt full hide" "bt full hide with Reverse disabled" \
|
||||
".*#0.*end_func.*str = $hex \"The End\".*st2 = $hex \"Is Near\".*b = 12.*c = 5.*#1.*in funca \\(\\).*#2.*in funcb \\(j=10\\).*bar = \{a = 42, b = 84\}.*#22.*in func1 \\(\\)\[^#\]*#24.*in func3 \\(i=3\\).*"
|
||||
|
||||
# Re-enable Reverse
|
||||
gdb_test_no_output "enable frame-filter global Reverse" \
|
||||
|
@ -155,7 +155,7 @@ gdb_test "break $breakloc" \
|
||||
"breakpoint at end of main"
|
||||
|
||||
# Signal handlers must be disabled
|
||||
gdb_test "handle all nostop noprint"
|
||||
gdb_test_lines "handle all nostop noprint" "" ""
|
||||
|
||||
# The list of signals that the program generates, in the order they
|
||||
# are generated.
|
||||
@ -276,7 +276,7 @@ gdb_test "record restore $precsave" \
|
||||
"reload precord save file"
|
||||
|
||||
# Signal handlers must be re-enabled
|
||||
gdb_test "handle all stop print"
|
||||
gdb_test_lines "handle all stop print" "" ""
|
||||
|
||||
# Make the first signal SIGABRT because it is always supported.
|
||||
set sig_supported 1
|
||||
|
@ -77,19 +77,23 @@ foreach inf_sel {1 2} {
|
||||
|
||||
gdb_test_no_output "set debug remote 1"
|
||||
|
||||
gdb_test_multiple "break -q main" "set breakpoint" {
|
||||
-re "Sending packet: \\\$qXfer:auxv:read.*$gdb_prompt $" {
|
||||
# Symbol lookup may access the target to read AUXV in
|
||||
# order to determine the debug base for SVR4 linker
|
||||
# namespaces.
|
||||
xfail "$gdb_test_name"
|
||||
}
|
||||
-re "Sending packet.*$gdb_prompt $" {
|
||||
fail "$gdb_test_name"
|
||||
}
|
||||
-re "^break -q main\r\nBreakpoint .* at .*$gdb_prompt $" {
|
||||
pass "$gdb_test_name"
|
||||
}
|
||||
set lines [gdb_get_lines "break -q main"]
|
||||
|
||||
set test "set breakpoint"
|
||||
set re_xfail \
|
||||
[string_to_regexp {Sending packet: $qXfer:auxv:read}]
|
||||
if { [regexp $re_xfail $lines] } {
|
||||
# Symbol lookup may access the target to read AUXV in
|
||||
# order to determine the debug base for SVR4 linker
|
||||
# namespaces.
|
||||
xfail $test
|
||||
} elseif { [regexp "Sending packet:" $lines] } {
|
||||
fail $test
|
||||
} else {
|
||||
set re \
|
||||
"Breakpoint $decimal at $hex: \[^\r\n\]+"
|
||||
set re "^$re\r\n$"
|
||||
gdb_assert { [regexp $re $lines] } $test
|
||||
}
|
||||
|
||||
gdb_test_no_output "set debug remote 0"
|
||||
|
@ -58,8 +58,8 @@ if { [istarget *-*-linux*] } {
|
||||
if { $do_xml_test } {
|
||||
# This is done in a way to avoid the timeout that can occur from
|
||||
# applying .* regexp to large output.
|
||||
gdb_test_sequence "info os processes" "get process list" \
|
||||
{ "pid +user +command" "1 +root +\[/a-z\]*(init|systemd|bash)" }
|
||||
gdb_test_lines "info os processes" "get process list" \
|
||||
"^pid +user +command.*\r\n1 +root +\[/a-z\]*(init|systemd|bash)"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user