public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/30236] New: gdb crashes inspecting value of enum with more than 2^15 enumerators
@ 2023-03-15 15:05 blue.swallow.71 at gmail dot com
  2023-03-15 15:08 ` [Bug gdb/30236] gdb crashes inspecting value of enum with more than 2^15 elements blue.swallow.71 at gmail dot com
  2023-03-15 18:23 ` simon.marchi at polymtl dot ca
  0 siblings, 2 replies; 3+ messages in thread
From: blue.swallow.71 at gmail dot com @ 2023-03-15 15:05 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30236
           Summary: gdb crashes inspecting value of enum with more than
                    2^15 enumerators
           Product: gdb
           Version: 12.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: blue.swallow.71 at gmail dot com
  Target Milestone: ---

Tested with gdb 12.1 and compiled with g++ 11.3.0

Description:

When debugging a program and trying to inspect (print) a value of an enum, gdb
will crash if said enum has more than 2^15 (32768) elements.

Steps to reproduce:
1) create foo.h and define an enum with more than 32768 elements.
===foo.h===
enum Foo {
    value1,
    value2,
    // more values
    value32769
};
===foo.h===

2) create main.cpp and use any value from Foo enum
===main.cpp
#include "foo.h"
int main() {
    Foo foo_var = value4;
    return 0;
}
===main.cpp===

3) compile main.cpp (e.g. g++ -g -O0 -o test main.cpp)
4) run gdb (e.g. gdb test)
5) setup a breakpoint at return 0; and run
6) inspect the value of foo_var or any of the elements of Foo (e.g. "print
foo_var" or "print (int)value12"
7) gdb will crash with the following message:

/build/gdb-ZgDh0V/gdb-12.1/gdb/gdbtypes.h:1064: internal-error: field:
Assertion `idx >= 0 && idx < num_fields ()' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x560dd53b8077 ???
0x560dd571ca64 ???
0x560dd571cca0 ???
0x560dd586c0e4 ???
0x560dd572be35 ???
0x560dd572b563 ???
0x560dd53de2ed ???
0x560dd572b6e5 ???
0x560dd55d7aa4 ???
0x560dd55d7d32 ???
0x560dd53ed654 ???
0x560dd56e3394 ???
0x560dd54bb9a4 ???
0x560dd54bbd43 ???
0x560dd54bc4c6 ???
0x7fbf92f05e0d ???
0x560dd54baa95 ???
0x560dd54bc374 ???
0x560dd54ba68b ???
0x560dd586c815 ???
0x560dd586ccaa ???
0x560dd557836c ???
0x560dd557a054 ???
0x560dd531015f ???
0x7fbf91e80d8f __libc_start_call_main
        ../sysdeps/nptl/libc_start_call_main.h:58
0x7fbf91e80e3f __libc_start_main_impl
        ../csu/libc-start.c:392
0x560dd5315bf4 ???
0xffffffffffffffff ???
---------------------
/build/gdb-ZgDh0V/gdb-12.1/gdb/gdbtypes.h:1064: internal-error: field:
Assertion `idx >= 0 && idx < num_fields ()' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

This is a bug, please report it.  For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.

/build/gdb-ZgDh0V/gdb-12.1/gdb/gdbtypes.h:1064: internal-error: field:
Assertion `idx >= 0 && idx < num_fields ()' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) y
Aborted (core dumped)

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

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

* [Bug gdb/30236] gdb crashes inspecting value of enum with more than 2^15 elements
  2023-03-15 15:05 [Bug gdb/30236] New: gdb crashes inspecting value of enum with more than 2^15 enumerators blue.swallow.71 at gmail dot com
@ 2023-03-15 15:08 ` blue.swallow.71 at gmail dot com
  2023-03-15 18:23 ` simon.marchi at polymtl dot ca
  1 sibling, 0 replies; 3+ messages in thread
From: blue.swallow.71 at gmail dot com @ 2023-03-15 15:08 UTC (permalink / raw)
  To: gdb-prs

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

Michał Kaczorowski <blue.swallow.71 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|gdb crashes inspecting      |gdb crashes inspecting
                   |value of enum with more     |value of enum with more
                   |than 2^15 enumerators       |than 2^15 elements

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

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

* [Bug gdb/30236] gdb crashes inspecting value of enum with more than 2^15 elements
  2023-03-15 15:05 [Bug gdb/30236] New: gdb crashes inspecting value of enum with more than 2^15 enumerators blue.swallow.71 at gmail dot com
  2023-03-15 15:08 ` [Bug gdb/30236] gdb crashes inspecting value of enum with more than 2^15 elements blue.swallow.71 at gmail dot com
@ 2023-03-15 18:23 ` simon.marchi at polymtl dot ca
  1 sibling, 0 replies; 3+ messages in thread
From: simon.marchi at polymtl dot ca @ 2023-03-15 18:23 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #1 from Simon Marchi <simon.marchi at polymtl dot ca> ---
I think this was already fixed:

https://gitlab.com/gnutools/binutils-gdb/-/commit/1775f8b3804744c22611ed0c9fd2df4f5b4d8641

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

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

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

end of thread, other threads:[~2023-03-15 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 15:05 [Bug gdb/30236] New: gdb crashes inspecting value of enum with more than 2^15 enumerators blue.swallow.71 at gmail dot com
2023-03-15 15:08 ` [Bug gdb/30236] gdb crashes inspecting value of enum with more than 2^15 elements blue.swallow.71 at gmail dot com
2023-03-15 18:23 ` 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).