public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion
@ 2023-10-30 16:38 josh.cottingham at linaro dot org
  2023-10-30 16:40 ` [Bug symtab/31010] " josh.cottingham at linaro dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: josh.cottingham at linaro dot org @ 2023-10-30 16:38 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 31010
           Summary: Evaluating "mixed-cased" fundamental types causes
                    hangs/OOM due to full symtab expansion
           Product: gdb
           Version: 13.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: josh.cottingham at linaro dot org
  Target Milestone: ---

Attempting to evaluate "mixed/uper-case" C/C++ fundamental types (such as
"output LONG" or "output Int") will cause GDB to try to fully expand the whole
symbol table. Depending on how large the binary we are debugging, this could
cause GDB to hang for several minutes and has been observed to cause
Out-of-Memory issues on some circumstances.

Via a git bisect, it was observed that this regression first occurs on the
commit which enables the new DWARF indexer:
https://sourceware.org/pipermail/gdb-patches/2022-April/187417.html

Easiest way to reproduce this issue is to attempt to run GDB on a debug build
of GDB:

$ gdb ./gdb/gdb
(gdb) start
Temporary breakpoint 1 at 0x410675: file gdb.c, line 28.
Starting program: /path/to/binutils-gdb/gdb/gdb 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, main (argc=1, argv=0x7fffffffd578) at gdb.c:28
28        memset (&args, 0, sizeof args);
(gdb) output LONG
No symbol "LONG" in current context.

This will take ~20-30 seconds, though as stated above with larger binaries it
has been observed to take make longer or cause Out-of-Memory. Worth noting the
hang does not occur if we attempt to output other non-existent symbols such as
"output NOTREAL".

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

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

* [Bug symtab/31010] Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion
  2023-10-30 16:38 [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion josh.cottingham at linaro dot org
@ 2023-10-30 16:40 ` josh.cottingham at linaro dot org
  2023-10-31  4:14 ` sam at gentoo dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: josh.cottingham at linaro dot org @ 2023-10-30 16:40 UTC (permalink / raw)
  To: gdb-prs

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

Josh Cottingham <josh.cottingham at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1
                 CC|                            |josh.cottingham at linaro dot org

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

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

* [Bug symtab/31010] Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion
  2023-10-30 16:38 [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion josh.cottingham at linaro dot org
  2023-10-30 16:40 ` [Bug symtab/31010] " josh.cottingham at linaro dot org
@ 2023-10-31  4:14 ` sam at gentoo dot org
  2023-10-31 17:30 ` tromey at sourceware dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sam at gentoo dot org @ 2023-10-31  4:14 UTC (permalink / raw)
  To: gdb-prs

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

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org,
                   |                            |tromey at sourceware dot org

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

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

* [Bug symtab/31010] Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion
  2023-10-30 16:38 [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion josh.cottingham at linaro dot org
  2023-10-30 16:40 ` [Bug symtab/31010] " josh.cottingham at linaro dot org
  2023-10-31  4:14 ` sam at gentoo dot org
@ 2023-10-31 17:30 ` tromey at sourceware dot org
  2023-11-30 17:15 ` tromey at sourceware dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-10-31 17:30 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
cooked_index_functions::expand_symtabs_matching defers to the
index, which uses case-insensitive lookup to handle things like
Ada and Fortran.

This probably needs some refinement.
Maybe a lookup_name ought to carry a language along with it.

Anyway more filtering could be done in the inner loop of that
function.

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

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

* [Bug symtab/31010] Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion
  2023-10-30 16:38 [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion josh.cottingham at linaro dot org
                   ` (2 preceding siblings ...)
  2023-10-31 17:30 ` tromey at sourceware dot org
@ 2023-11-30 17:15 ` tromey at sourceware dot org
  2024-01-20  8:36 ` sam at gentoo dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2023-11-30 17:15 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |29366


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=29366
[Bug 29366] [meta] New DWARF indexer meta bug
-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug symtab/31010] Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion
  2023-10-30 16:38 [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion josh.cottingham at linaro dot org
                   ` (3 preceding siblings ...)
  2023-11-30 17:15 ` tromey at sourceware dot org
@ 2024-01-20  8:36 ` sam at gentoo dot org
  2024-02-15 17:02 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: sam at gentoo dot org @ 2024-01-20  8:36 UTC (permalink / raw)
  To: gdb-prs

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

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://sourceware.org/bugz
                   |                            |illa/show_bug.cgi?id=30520

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

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

* [Bug symtab/31010] Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion
  2023-10-30 16:38 [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion josh.cottingham at linaro dot org
                   ` (4 preceding siblings ...)
  2024-01-20  8:36 ` sam at gentoo dot org
@ 2024-02-15 17:02 ` tromey at sourceware dot org
  2025-02-04 15:38 ` josh.cottingham at linaro dot org
  2025-02-05 10:15 ` josh.cottingham at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2024-02-15 17:02 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Closing this as a dup, since it seems to be basically the
same problem as the other bug, and that bug has a patch.
Worth noting that this problem is reported as being fixed
by that patch as well.

*** This bug has been marked as a duplicate of bug 30520 ***

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

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

* [Bug symtab/31010] Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion
  2023-10-30 16:38 [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion josh.cottingham at linaro dot org
                   ` (5 preceding siblings ...)
  2024-02-15 17:02 ` tromey at sourceware dot org
@ 2025-02-04 15:38 ` josh.cottingham at linaro dot org
  2025-02-05 10:15 ` josh.cottingham at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: josh.cottingham at linaro dot org @ 2025-02-04 15:38 UTC (permalink / raw)
  To: gdb-prs

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

Josh Cottingham <josh.cottingham at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |---
             Status|RESOLVED                    |UNCONFIRMED

--- Comment #3 from Josh Cottingham <josh.cottingham at linaro dot org> ---
After trying with both GDB 15.1 and GDB 16.1 I am lead to believe that this
issue has not actually been solved in bug 30520.

When testing with the following patch
https://sourceware.org/pipermail/gdb-patches/2024-January/205924.html it did
appear to be solved and no longer occurring.

However, since then it looks like it was proposed to move to from name matching
the full name to name matching on the canonical name. By the time the patch was
implemented again with this change in
https://sourceware.org/pipermail/gdb-patches/2024-May/209010.html it appears
that this issue was still occurring.

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

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

* [Bug symtab/31010] Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion
  2023-10-30 16:38 [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion josh.cottingham at linaro dot org
                   ` (6 preceding siblings ...)
  2025-02-04 15:38 ` josh.cottingham at linaro dot org
@ 2025-02-05 10:15 ` josh.cottingham at linaro dot org
  7 siblings, 0 replies; 9+ messages in thread
From: josh.cottingham at linaro dot org @ 2025-02-05 10:15 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Josh Cottingham <josh.cottingham at linaro dot org> ---
For simplicity, I have created a GDB test which you can use for validation if
you like:


# Copyright 1998-2025 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# This file was written by Joshua Cottingham (josh.cottingham@linaro.org)

# Used to catch regression where GDB would expand CU table when printing
# fundamental types that are in "mixed-case".

standard_testfile break.c break1.c

if {[prepare_for_testing "failed to prepare" $testfile \
         [list $srcfile $srcfile2] {debug nowarnings}]} {
    return -1
}

set readnow_p [readnow]

# The command we test here produce many lines of output; disable "press
# <return> to continue" prompts.
gdb_test_no_output "set height 0"

gdb_file_cmd ${binfile}

# Check no CU are currently read before starting the program
gdb_test "maint print statistics" \
    ".*Number of read CUs: 0.*" \
    "No CU are read at the start"

gdb_test "print INT" "" "printing uppercase fundamental type"

# Now check CUs have still not been read after printing
gdb_test "maint print statistics" \
    ".*Number of read CUs: 0.*" \
    "No CU are read after printing fundamental type"
``

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

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

end of thread, other threads:[~2025-02-05 10:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30 16:38 [Bug symtab/31010] New: Evaluating "mixed-cased" fundamental types causes hangs/OOM due to full symtab expansion josh.cottingham at linaro dot org
2023-10-30 16:40 ` [Bug symtab/31010] " josh.cottingham at linaro dot org
2023-10-31  4:14 ` sam at gentoo dot org
2023-10-31 17:30 ` tromey at sourceware dot org
2023-11-30 17:15 ` tromey at sourceware dot org
2024-01-20  8:36 ` sam at gentoo dot org
2024-02-15 17:02 ` tromey at sourceware dot org
2025-02-04 15:38 ` josh.cottingham at linaro dot org
2025-02-05 10:15 ` josh.cottingham at linaro dot 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).