public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "blue.swallow.71 at gmail dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug gdb/30236] New: gdb crashes inspecting value of enum with more than 2^15 enumerators Date: Wed, 15 Mar 2023 15:05:27 +0000 [thread overview] Message-ID: <bug-30236-4717@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2023-03-15 15:05 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-15 15:05 blue.swallow.71 at gmail dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-30236-4717@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).