[PATCH][gdb/symtab] Prefer def over decl (inter-CU case)

Tom de Vries tdevries@suse.de
Thu Apr 23 13:57:17 GMT 2020


On 09-04-2020 16:30, Tom de Vries wrote:
> Hi,
> 
> When running test-case gdb.threads/tls.exp with target board -readnow, we
> have:
> ...
> (gdb) print a_thread_local^M
> Cannot find thread-local storage for process 0, executable file tls/tls:^M
> Cannot find thread-local variables on this target^M
> (gdb) FAIL: gdb.threads/tls.exp: print a_thread_local
> ...
> while with native we have:
> ...
> (gdb) print a_thread_local^M
> Cannot read `a_thread_local' without registers^M
> (gdb) PASS: gdb.threads/tls.exp: print a_thread_local
> ...
> 
> The difference in behaviour can be explained as follows.  Without -readnow, we
> have two a_thread_locals, the def and the decl, each in a different CU:
> ...
> $ gdb -batch outputs/gdb.threads/tls/tls \
>     -ex "maint expand-symtabs" \
>     -ex "print a_thread_local" \
>     -ex "maint print symbols" \
>     | grep "a_thread_local;"
> Cannot read `a_thread_local' without registers
>  int a_thread_local; computed at runtime
>  int a_thread_local; unresolved
> ...
> and with -readnow, we have the opposite order:
> ...
> $ gdb -readnow -batch outputs/gdb.threads/tls/tls  \
>     -ex "maint expand-symtabs" \
>     -ex "print a_thread_local" \
>     -ex "maint print symbols" \
>     | grep "a_thread_local;"
> Cannot find thread-local storage for process 0, executable file tls/tls:
> Cannot find thread-local variables on this target
>  int a_thread_local; unresolved
>  int a_thread_local; computed at runtime
> ...
> 
> Fix the FAIL by preferring the def over the decl (something we already do
> intra-CU since the fix for PR24971, commit 93e55f0a03 "[gdb/symtab] Prefer var
> def over decl").
> 
> Build and reg-tested on x86_64-linux.
> 

Committed.

Thanks,
- Tom


More information about the Gdb-patches mailing list