public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site
@ 2024-12-03 15:12 vries at gcc dot gnu.org
  2024-12-03 15:12 ` [Bug symtab/32410] " vries at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2024-12-03 15:12 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 32410
           Summary: [gdb/symtab] segfault in
                    compunit_symtab::find_call_site
           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: ---

On s390x I ran into:
...
(gdb) PASS: gdb.stabs/gdb11479.exp: forced_stabs: set breakpoints
continue^M
Continuing.^M
Recursive internal problem.^M
^@ERROR: GDB process no longer exists
GDB process exited with wait status 2741 exp9 0 1
UNRESOLVED: gdb.stabs/gdb11479.exp: forced_stabs: stop at first breakpoint in \
test2 function
...

With gdb we find that it's a segfault:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x00000000014ae41a in std::vector<call_site*, std::allocator<call_site*>
>::begin (this=0x0) at /usr/include/c++/7/bits/stl_vector.h:573
573           { return const_iterator(this->_M_impl._M_start); }
...
due to:
...
(gdb) down
#5  0x0000000001bc339c in compunit_symtab::find_call_site (this=0x420a450, 
    pc=16779034) at /dev/shm/vries/gdb/src/gdb/symtab.c:401
401       if (auto it = m_call_site_htab->find (static_cast<unrelocated_addr>
(pc - delta));
(gdb) p m_call_site_htab
$1 = (call_site_htab_t *) 0x0
(gdb) 
...

Looks like a regression since commit de2b4ab50de ("Convert
dwarf2_cu::call_site_htab to new hash table"), which did:
...
 call_site *
 compunit_symtab::find_call_site (CORE_ADDR pc) const
 {
-  if (m_call_site_htab == nullptr)
-    return nullptr;
-
...

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

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

* [Bug symtab/32410] [gdb/symtab] segfault in compunit_symtab::find_call_site
  2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
@ 2024-12-03 15:12 ` vries at gcc dot gnu.org
  2024-12-03 15:16 ` vries at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2024-12-03 15:12 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

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

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

* [Bug symtab/32410] [gdb/symtab] segfault in compunit_symtab::find_call_site
  2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
  2024-12-03 15:12 ` [Bug symtab/32410] " vries at gcc dot gnu.org
@ 2024-12-03 15:16 ` vries at gcc dot gnu.org
  2024-12-03 15:16 ` vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2024-12-03 15:16 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 15813
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15813&action=edit
gdb.log

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

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

* [Bug symtab/32410] [gdb/symtab] segfault in compunit_symtab::find_call_site
  2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
  2024-12-03 15:12 ` [Bug symtab/32410] " vries at gcc dot gnu.org
  2024-12-03 15:16 ` vries at gcc dot gnu.org
@ 2024-12-03 15:16 ` vries at gcc dot gnu.org
  2024-12-03 15:17 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2024-12-03 15:16 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 15814
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15814&action=edit
overloads exec, gzipped

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

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

* [Bug symtab/32410] [gdb/symtab] segfault in compunit_symtab::find_call_site
  2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-12-03 15:16 ` vries at gcc dot gnu.org
@ 2024-12-03 15:17 ` vries at gcc dot gnu.org
  2024-12-03 15:18 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2024-12-03 15:17 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #15813|0                           |1
        is obsolete|                            |

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

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

* [Bug symtab/32410] [gdb/symtab] segfault in compunit_symtab::find_call_site
  2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-12-03 15:17 ` vries at gcc dot gnu.org
@ 2024-12-03 15:18 ` vries at gcc dot gnu.org
  2024-12-03 15:49 ` simark at simark dot ca
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2024-12-03 15:18 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #15814|0                           |1
        is obsolete|                            |

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

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

* [Bug symtab/32410] [gdb/symtab] segfault in compunit_symtab::find_call_site
  2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-12-03 15:18 ` vries at gcc dot gnu.org
@ 2024-12-03 15:49 ` simark at simark dot ca
  2024-12-03 16:12 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: simark at simark dot ca @ 2024-12-03 15:49 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Simon Marchi <simark at simark dot ca> ---
(In reply to Tom de Vries from comment #0)
> On s390x I ran into:
> ...
> (gdb) PASS: gdb.stabs/gdb11479.exp: forced_stabs: set breakpoints
> continue^M
> Continuing.^M
> Recursive internal problem.^M
> ^@ERROR: GDB process no longer exists
> GDB process exited with wait status 2741 exp9 0 1
> UNRESOLVED: gdb.stabs/gdb11479.exp: forced_stabs: stop at first breakpoint
> in \
> test2 function
> ...
> 
> With gdb we find that it's a segfault:
> ...
> Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
> 0x00000000014ae41a in std::vector<call_site*, std::allocator<call_site*>
> >::begin (this=0x0) at /usr/include/c++/7/bits/stl_vector.h:573
> 573	      { return const_iterator(this->_M_impl._M_start); }
> ...
> due to:
> ...
> (gdb) down
> #5  0x0000000001bc339c in compunit_symtab::find_call_site (this=0x420a450, 
>     pc=16779034) at /dev/shm/vries/gdb/src/gdb/symtab.c:401
> 401	  if (auto it = m_call_site_htab->find (static_cast<unrelocated_addr>
> (pc - delta));
> (gdb) p m_call_site_htab
> $1 = (call_site_htab_t *) 0x0
> (gdb) 
> ...
> 
> Looks like a regression since commit de2b4ab50de ("Convert
> dwarf2_cu::call_site_htab to new hash table"), which did:
> ...
>  call_site *
>  compunit_symtab::find_call_site (CORE_ADDR pc) const
>  {
> -  if (m_call_site_htab == nullptr)
> -    return nullptr;
> -
> ...


I see no good reason to remove that `if`.  My guess is that I tried to make
`m_call_site_htab` not a pointer, realized I couldn't (`compunit_symtab`
doesn't have a destructor that gets called, currently).

I'll send a patch that reverts that bit.

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

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

* [Bug symtab/32410] [gdb/symtab] segfault in compunit_symtab::find_call_site
  2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-12-03 15:49 ` simark at simark dot ca
@ 2024-12-03 16:12 ` vries at gcc dot gnu.org
  2024-12-03 19:19 ` cvs-commit at gcc dot gnu.org
  2024-12-03 19:20 ` simon.marchi at polymtl dot ca
  8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2024-12-03 16:12 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 15817
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15817&action=edit
gdb.log from gdb with proposed patch

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

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

* [Bug symtab/32410] [gdb/symtab] segfault in compunit_symtab::find_call_site
  2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-12-03 16:12 ` vries at gcc dot gnu.org
@ 2024-12-03 19:19 ` cvs-commit at gcc dot gnu.org
  2024-12-03 19:20 ` simon.marchi at polymtl dot ca
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-12-03 19:19 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Simon Marchi <simark@sourceware.org>:

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

commit 22a7a2d12a81a4c4521d1d9996d06b7abf315acc
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Tue Dec 3 10:52:18 2024 -0500

    gdb: restore nullptr check in compunit_symtab::find_call_site

    Commit de2b4ab50de ("Convert dwarf2_cu::call_site_htab to new hash
    table") removed this nullptr check for no good reason.  This causes a
    crash if `m_call_site_htab` is not set, as shown in PR 32410.  My guess
    is that when doing this change, I tried to make `m_call_site_htab` not a
    pointer, removed this check, then realized it wasn't so obvious, and
    forgot to re-add the check.

    Change-Id: I455e00cdc0519dfb412dc7826d17a839b77aae69
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32410
    Approved-By: Tom Tromey <tom@tromey.com>
    Approved-By: Tom de Vries <tdevries@suse.de>

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

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

* [Bug symtab/32410] [gdb/symtab] segfault in compunit_symtab::find_call_site
  2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-12-03 19:19 ` cvs-commit at gcc dot gnu.org
@ 2024-12-03 19:20 ` simon.marchi at polymtl dot ca
  8 siblings, 0 replies; 10+ messages in thread
From: simon.marchi at polymtl dot ca @ 2024-12-03 19:20 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simon.marchi at polymtl dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simon.marchi at polymtl dot ca
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #6 from Simon Marchi <simon.marchi at polymtl dot ca> ---
Fixed.

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

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

end of thread, other threads:[~2024-12-03 19:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-03 15:12 [Bug symtab/32410] New: [gdb/symtab] segfault in compunit_symtab::find_call_site vries at gcc dot gnu.org
2024-12-03 15:12 ` [Bug symtab/32410] " vries at gcc dot gnu.org
2024-12-03 15:16 ` vries at gcc dot gnu.org
2024-12-03 15:16 ` vries at gcc dot gnu.org
2024-12-03 15:17 ` vries at gcc dot gnu.org
2024-12-03 15:18 ` vries at gcc dot gnu.org
2024-12-03 15:49 ` simark at simark dot ca
2024-12-03 16:12 ` vries at gcc dot gnu.org
2024-12-03 19:19 ` cvs-commit at gcc dot gnu.org
2024-12-03 19:20 ` simon.marchi at polymtl dot ca

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).