This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH][gdb/testsuite] Rewrite catch-follow-exec.exp
On 10/16/18 12:11 AM, Simon Marchi wrote:
>> + gdb_test_multiple "" "run til exit" {
>> + "runtime error:" {
>> + # Error in case of --enable-ubsan
>> + fail "No runtime error"
>> + }
>
> Can you explain what this catches? If this isn't there but UBSan is
> enabled, the crash isn't detected properly by the code below?
Indeed.
If I disable the fix this test-case is testing (so, I'm trying to make
the test-case fail), and I build with --disable-ubsan, I get:
...
27079 exp8 0 0 CHILDKILLED SIGSEGV {segmentation violation}
PASS: gdb.base/catch-follow-exec.exp: [lindex $result 2] == 0
FAIL: gdb.base/catch-follow-exec.exp: [lindex $result 3] == 1
FAIL: gdb.base/catch-follow-exec.exp: [llength $result] == 4
...
and with --enable-ubsan:
...
^[[1m/data/gdb_versions/devel/src/gdb/infcmd.c:2099:11:^[[1m^[[31m
runtime error: ^[[1m^[[0m^[[1mmember access wi\
thin null pointer of type 'struct thread_info'^[[1m^[[0m^M
FAIL: gdb.base/catch-follow-exec.exp: No runtime error
...
Without the extra "runtime error:" clause, I'm not detecting the fail:
...
^[[1m/data/gdb_versions/devel/src/gdb/infcmd.c:2099:11:^[[1m^[[31m
runtime error: ^[[1m^[[0m^[[1mmember access wi\
thin null pointer of type 'struct thread_info'^[[1m^[[0m^M
PASS: gdb.base/catch-follow-exec.exp: [lindex $result 2] == 0
PASS: gdb.base/catch-follow-exec.exp: [lindex $result 3] == 1
PASS: gdb.base/catch-follow-exec.exp: [llength $result] == 4
...
Thanks,
- Tom