Bug 26799 - [readnow] FAIL: gdb.rust/traits.exp: print *td
Summary: [readnow] FAIL: gdb.rust/traits.exp: print *td
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: rust (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 11.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-28 09:37 UTC by Tom de Vries
Modified: 2020-11-12 15:58 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
gzipped exec (235.28 KB, application/gzip)
2020-10-28 09:38 UTC, Tom de Vries
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2020-10-28 09:37:25 UTC
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
...
Comment 1 Tom de Vries 2020-10-28 09:38:42 UTC
Created attachment 12923 [details]
gzipped exec
Comment 2 Tom Tromey 2020-10-31 20:16:10 UTC
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.
Comment 3 Tom Tromey 2020-11-01 00:40:18 UTC
I have a patch.
Comment 4 Tom Tromey 2020-11-01 00:44:40 UTC
Note this is known not to work with gdb_index.
Comment 5 Sourceware Commits 2020-11-12 15:56:33 UTC
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.
Comment 6 Tom Tromey 2020-11-12 15:58:52 UTC
Fixed.