public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/28539] New: segfault in search_one_symtab
@ 2021-11-03 16:43 vries at gcc dot gnu.org
  2021-11-03 16:45 ` [Bug symtab/28539] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-11-03 16:43 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28539

            Bug ID: 28539
           Summary: segfault in search_one_symtab
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

A user reported a gdb crash with gdb-11.1 (
https://bugzilla.opensuse.org/show_bug.cgi?id=1192285 ) and shared the
reproducer with me.

The reproducer is something like:
...
$ gdb -q -batch exec core -ex bt
...

I managed to reproduce with master.

AFAIU, the following happens.

psymbol_functions::expand_symtabs_matching is called and we arrive here:
...
          struct compunit_symtab *symtab =
            psymtab_to_symtab (objfile, ps);

          if (expansion_notify != NULL)
            if (!expansion_notify (symtab))
              return false;
...
with symtab == nullptr due to ps being a dwarf2_include_psymtab.

The expansion_notify is lambda function search_one_symtab, as passed by
objfile::lookup_symbol and the null pointer is dereferenced here:
...
  auto search_one_symtab = [&] (compunit_symtab *stab)
  {
    ...
    const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/28539] segfault in search_one_symtab
  2021-11-03 16:43 [Bug symtab/28539] New: segfault in search_one_symtab vries at gcc dot gnu.org
@ 2021-11-03 16:45 ` vries at gcc dot gnu.org
  2021-11-12 17:17 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-11-03 16:45 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28539

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
I tried this patch:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 48fb55c308c..9cd9ab4fbf1 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5787,7 +5787,7 @@ struct dwarf2_include_psymtab : public partial_symtab

   compunit_symtab *get_compunit_symtab (struct objfile *objfile) const
override
   {
-    return nullptr;
+    return includer ()->get_compunit_symtab (objfile);
   }

 private:
...
and I was able to finish the backtrace.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/28539] segfault in search_one_symtab
  2021-11-03 16:43 [Bug symtab/28539] New: segfault in search_one_symtab vries at gcc dot gnu.org
  2021-11-03 16:45 ` [Bug symtab/28539] " vries at gcc dot gnu.org
@ 2021-11-12 17:17 ` vries at gcc dot gnu.org
  2021-11-14 18:23 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-11-12 17:17 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28539

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2021-November/183363.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/28539] segfault in search_one_symtab
  2021-11-03 16:43 [Bug symtab/28539] New: segfault in search_one_symtab vries at gcc dot gnu.org
  2021-11-03 16:45 ` [Bug symtab/28539] " vries at gcc dot gnu.org
  2021-11-12 17:17 ` vries at gcc dot gnu.org
@ 2021-11-14 18:23 ` vries at gcc dot gnu.org
  2021-11-29 11:40 ` jirislaby at gmail dot com
  2021-11-29 15:23 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-11-14 18:23 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28539

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Reproduced with:
- master
- gdb-11-branch

On 10.2, runs into PR26327.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/28539] segfault in search_one_symtab
  2021-11-03 16:43 [Bug symtab/28539] New: segfault in search_one_symtab vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-11-14 18:23 ` vries at gcc dot gnu.org
@ 2021-11-29 11:40 ` jirislaby at gmail dot com
  2021-11-29 15:23 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jirislaby at gmail dot com @ 2021-11-29 11:40 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28539

Jiri Slaby <jirislaby at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jirislaby at gmail dot com

--- Comment #4 from Jiri Slaby <jirislaby at gmail dot com> ---
Any news on this? I am repeatedly hitting it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug symtab/28539] segfault in search_one_symtab
  2021-11-03 16:43 [Bug symtab/28539] New: segfault in search_one_symtab vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-11-29 11:40 ` jirislaby at gmail dot com
@ 2021-11-29 15:23 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-11-29 15:23 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=28539

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.1
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=49fa1332a69bc4b09d2cc7db587e27ea30f2a29d

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-29 15:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-03 16:43 [Bug symtab/28539] New: segfault in search_one_symtab vries at gcc dot gnu.org
2021-11-03 16:45 ` [Bug symtab/28539] " vries at gcc dot gnu.org
2021-11-12 17:17 ` vries at gcc dot gnu.org
2021-11-14 18:23 ` vries at gcc dot gnu.org
2021-11-29 11:40 ` jirislaby at gmail dot com
2021-11-29 15:23 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).