I ran into the following FAIL:
...
(gdb) PASS: gdb.threads/stepi-over-clone.exp: catch process syscalls
continue^M
Continuing.^M
^M
Catchpoint 2 (call to syscall clone), clone () at \
../sysdeps/unix/sysv/linux/x86_64/clone.S:78^M
warning: 78 ../sysdeps/unix/sysv/linux/x86_64/clone.S: \
No such file or directory^M
(gdb) FAIL: gdb.threads/stepi-over-clone.exp: continue
...
All but one regexps in the .exp file use "clone\[23\]?" with "?" to
also accept "clone", except the failing case. This commit fixes that
case to also use "?".
Furthermore, there are FAILs like this:
...
(gdb) PASS: gdb.threads/stepi-over-clone.exp: third_thread=false: \
non-stop=on: displaced=off: i=0: continue
stepi^M
[New Thread 0x7ffff7ff8700 (LWP 15301)]^M
Hello from the first thread.^M
78 in ../sysdeps/unix/sysv/linux/x86_64/clone.S^M
(gdb) XXX: Consume the initial command
XXX: Consume new thread line
XXX: Consume first worker thread message
FAIL: gdb.threads/stepi-over-clone.exp: third_thread=false: non-stop=on: \
displaced=off: i=0: stepi
...
because this output is expected instead:
...
Hello from the first thread.^M
0x00000000004212cd in clone3 ()^M
...
The root cause for the difference is the presence of .debug_line info for
clone.
Fix this by updating the relevant regexps.
Tested on x86_64-linux, specifically:
- openSUSE Leap 15.4 (where the FAILs where observed), and
- openSUSE Tumbleweed (where the FAILs where not observed).
Co-Authored-By: Pedro Alves <pedro@palves.net>
Approved-By: Pedro Alves <pedro@palves.net>
Change-Id: I74ca9e7d4cfe6af294fd50e8c509fcbad289b78c
+set re_loc1 "$hex in clone\[23\]? \\(\\)"
+set re_loc2 "$decimal\[ \t\]+in \[^\r\n\]+"
+set re_loc3 "clone\[23\]? \\(\\) at \[^:\]+:$decimal"
+
- "Catchpoint $decimal \\(call to syscall clone\[23\]\\), .*"
+ "Catchpoint $decimal \\(call to syscall clone\[23\]?\\), ($re_loc1|$re_loc3).*"
# Return true if INSN is a syscall instruction.
# Return true if INSN is a syscall instruction.
- -re "^$hex in clone\[23\]? \\(\\)\r\n" {
+ -re "^($::re_loc1|$::re_loc2)\r\n" {
verbose -log "XXX: Consume stop location line"
set thread_1_stopped true
if { !$seen_prompt } {
verbose -log "XXX: Consume stop location line"
set thread_1_stopped true
if { !$seen_prompt } {
- -re "^Thread 2\[^\r\n\]+ hit Breakpoint $decimal, $hex in clone\[23\]? \\(\\)\r\n" {
+ -re "^Thread 2\[^\r\n\]+ hit Breakpoint $decimal, ($::re_loc1|$::re_loc3)\r\n" {
verbose -log "XXX: Consume thread 2 hit breakpoint"
set thread_2_stopped true
if { !$seen_prompt } {
verbose -log "XXX: Consume thread 2 hit breakpoint"
set thread_2_stopped true
if { !$seen_prompt } {
# always still be in clone.
set match_code {}
lappend match_code {
# always still be in clone.
set match_code {}
lappend match_code {
- -re "\\*?\\s+1\\s+Thread\[^\r\n\]+clone\[23\]? \\(\\)\r\n" {
+ -re "\\*?\\s+1\\s+Thread\[^\r\n\]+($::re_loc1|$::re_loc3)\r\n" {
incr thread_count
exp_continue
}
incr thread_count
exp_continue
}
# be stopped at the breakpoint in clone (just before the
# third thread is actually created).
lappend match_code {
# be stopped at the breakpoint in clone (just before the
# third thread is actually created).
lappend match_code {
- -re "\\*?\\s+2\\s+Thread\[^\r\n\]+$hex in clone\[23\]? \\(\\)\r\n" {
+ -re "\\*?\\s+2\\s+Thread\[^\r\n\]+($::re_loc1|$::re_loc3)\r\n" {
incr thread_count
exp_continue
}
incr thread_count
exp_continue
}