Re: [PATCH v2 00/42] Share DWARF partial symtabs between objfiles

Tom de Vries
2020-05-29T10:23:54Z

On 27-05-2020 17:51, Simon Marchi wrote:
> On 2020-05-27 10:53 a.m., Simon Marchi wrote:
>> I added another patch to the series, see here:
>>
>> https://sourceware.org/pipermail/gdb-patches/2020-May/169065.html
>>
>> The gdb.base/infcall-nested-structs-c.exp / gdb.base/infcall-nested-structs-c++.exp failures
>> just appeared to be intermittent failures in the end. So I think that with this last patch,
>> the series would be good to go.
>>
>> Simon
>>
>
> All right, the series is now pushed! With such a change, I do expect some things to break,
> please let me know if you see some unexpected behavior chgange following this.
>

Hi Simon,

I'm working on enabling the .gdb_index for ada, and after rebasing that
patch series to recent master I ran into a failure with target board
cc-with-gdb-index I thought I hadn't seen before, in
gdb.ada/mi_catch_assert.exp and a few more similar ada test-case.

I managed to minimize and de-mi the failure to:
...
$ cat cmd.gdb
file
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/mi_catch_assert/bla
file
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/mi_catch_assert/bla
tbreak main
run
catch assert
cond 2 Global_Var = 2
continue
$ gdb -batch -ex "set sysroot" -x=cmd.gdb
Temporary breakpoint 1 at 0x401f39: file
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/mi_catch_assert/b~bla.adb,
line 132.

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffdb98,
envp=0x7fffffffdba8) at
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/mi_catch_assert/b~bla.adb:132
132 Ensure_Reference : aliased System.Address :=
Ada_Main_Program_Name'Address;
Catchpoint 2: failed Ada assertions

Catchpoint 2, failed assertion at <__gnat_debug_raise_assert_failure> ()
at s-excdeb.adb:64
64 s-excdeb.adb: Bestand of map bestaat niet.
...
while the expected output is:
...
Catchpoint 2, failed assertion at 0x000000000040200a in bla () at
/data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/mi_catch_assert/bla.adb:32
32 pragma Assert (Global_Var = 1, "Error #2"); -- STOP
...

Seeing the repetition of file command in the cmd.gdb file (and how
commenting out one of them made the test pass), I started suspecting
this patch series, and wondered if I could reproduce the same or similar
problems on master using a test-suite hack:
...
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 444cea01c3..fa2a999525 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4823,7 +4823,12 @@ proc gdb_load_shlib { file } {
#
proc gdb_load { arg } {
if { $arg != "" } {
- return [gdb_file_cmd $arg]
+ set res [gdb_file_cmd $arg]
+ if { $res != 0 } {
+ return $res
+ }
+ set res [gdb_file_cmd $arg]
+ return $res
}
return 0
}
...

And indeed, quite a few failures showed up. I picked one:
gdb.base/langs.exp.

So, on master, after this patch series, with target board
cc-with-gdb-index, we have:
...
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.base/langs.exp ...
FAIL: gdb.base/langs.exp: up to foo in langs.exp
FAIL: gdb.base/langs.exp: show language at foo in langs.exp
FAIL: gdb.base/langs.exp: up to cppsub_ in langs.exp
FAIL: gdb.base/langs.exp: show language at cppsub_ in langs.exp
FAIL: gdb.base/langs.exp: up to fsub in langs.exp
FAIL: gdb.base/langs.exp: show language at fsub in langs.exp

=== gdb Summary ===

# of expected passes 10
# of unexpected failures 6
...
while with native we have:
...
Running /data/gdb_versions/devel/src/gdb/testsuite/gdb.base/langs.exp ...

=== gdb Summary ===

# of expected passes 16
...

Before this patch series, the test-case passes without any FAILs with
target board cc-with-gdb-index.

Thanks,
- Tom