With target board -readnow, we run into: ... (gdb) print *td^M Attempt to take contents of a non-pointer value.^M (gdb) FAIL: gdb.rust/traits.exp: print *td print *tu^M Attempt to take contents of a non-pointer value.^M (gdb) FAIL: gdb.rust/traits.exp: print *tu ...
Created attachment 12923 [details] gzipped exec
find_symbol_at_address does not allow the possibility of an objfile that has symtabs but no psymtabs. So, it doesn't work correctly with -readnow. I think this is a bug in that function. One idea might be that in this case: if (objfile->sf == NULL || objfile->sf->qf->find_compunit_symtab_by_address == NULL) continue; ... to instead search all the symtabs of the objfile.
I have a patch.
Note this is known not to work with gdb_index.
The master branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1f2624a35413c31c317e5da8ce7401b59ecfbfa5 commit 1f2624a35413c31c317e5da8ce7401b59ecfbfa5 Author: Tom Tromey <tom@tromey.com> Date: Thu Nov 12 08:47:09 2020 -0700 Fix Rust regression with -readnow PR rust/26799 points out that a certain test case fails with -readnow. This happens because, with -readnow, there are no partial symtabs; but find_symbol_at_address requires these. This patch fixes this problem by searching all of an objfile's compunit symtabs if it does not have partial symbols. Note that this test will still fail with .gdb_index. I don't think that is readily fixable. gdb/ChangeLog 2020-11-12 Tom Tromey <tom@tromey.com> PR rust/26799: * symtab.c (find_symbol_at_address): Search symtabs if no psymtabs exist. gdb/testsuite/ChangeLog 2020-11-12 Tom Tromey <tom@tromey.com> PR rust/26799: * gdb.rust/traits.exp: Remove kfails.
Fixed.