Bug 30712 - [gdb/symtab, native-extended-gdbserver] segfault in gdb.base/index-cache.exp (extended test-case)
Summary: [gdb/symtab, native-extended-gdbserver] segfault in gdb.base/index-cache.exp ...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: symtab (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 14.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-01 11:34 UTC by Tom de Vries
Modified: 2023-08-04 13:09 UTC (History)
0 users

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


Attachments
Tentative patch (1.63 KB, patch)
2023-08-01 11:34 UTC, Tom de Vries
Details | Diff
gdb.log (5.24 KB, text/x-log)
2023-08-01 11:35 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 2023-08-01 11:34:55 UTC
Created attachment 15031 [details]
Tentative patch

Using this tentative patch for gdb.base/index-cache.exp I run into a segfault with target board native-extended-gdbserver.
Comment 1 Tom de Vries 2023-08-01 11:35:13 UTC
Created attachment 15032 [details]
gdb.log
Comment 3 Sourceware Commits 2023-08-04 13:03:23 UTC
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b44293099e215d6558a8d91b5eaab137218d2e27

commit b44293099e215d6558a8d91b5eaab137218d2e27
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Aug 4 15:02:43 2023 +0200

    [gdb/testsuite] Extend gdb.base/index-cache.exp
    
    The test-case gdb.base/index-cache.exp uses only one source file, which
    contains main.
    
    While doing "file $exec", in set_initial_language a symbol lookup of "main" is
    done, causing the symtab containing main to be expanded.
    
    Handling of main is special, and a future optimization may skip the lookup and
    expansion.
    
    Reliably exercise:
    - the lookup of main, expanding the symtab containing main, by doing
      "ptype main", and
    - the lookup of another symbol, expanding a symtab not containing main, by:
      - adding another source file containing function foo, and
      - doing "ptype foo".
    
    This triggered a segfault with target board native-extended-gdbserver, filed
    as PR symtab/30712, but that seems to be fixed by a previous commit in this
    series.
    
    Tested on x86_64-linux.
    
    Approved-By: Tom Tromey <tom@tromey.com>
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30712
Comment 4 Tom de Vries 2023-08-04 13:09:20 UTC
Fixed.