public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "udaysha01 at gmail dot com" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug symtab/29950] New: debugging stabs+ binary hits assertion`idx >= 0 && idx < num_fields ()' Date: Fri, 30 Dec 2022 23:43:57 +0000 [thread overview] Message-ID: <bug-29950-4717@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=29950 Bug ID: 29950 Summary: debugging stabs+ binary hits assertion`idx >= 0 && idx < num_fields ()' Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: symtab Assignee: unassigned at sourceware dot org Reporter: udaysha01 at gmail dot com Target Milestone: --- Environment: gdb version: GNU gdb (GDB) 14.0.50.20221230-git (built from hash cb2a1d0aca416235aed885e4796eeb70fbcd3b95) configured as: This GDB was configured as "x86_64-pc-linux-gnu". uname -a: Linux uday-arch 6.1.1-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Wed, 21 Dec 2022 22:27:59 +0000 x86_64 GNU/Linux gcc version: gcc (GCC) 12.2.0 How to trigger the bug: 1. create a file test.c with the following content: #include <stdbool.h> bool f() { return true; } 2. build it with gcc -gstabs+ test.c -c -o test.o 3. launch gdb test.o and run "info func" 4. resulting assertion and backtrace: (gdb) info func gdbtypes.h:985: internal-error: field: Assertion `idx >= 0 && idx < num_fields ()' failed. A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- 0x55bec1e6400b gdb_internal_backtrace_1 /home/uday/programs/binutils-gdb/gdb/bt-utils.c:122 0x55bec1e6400b _Z22gdb_internal_backtracev /home/uday/programs/binutils-gdb/gdb/bt-utils.c:168 0x55bec226bc3c internal_vproblem /home/uday/programs/binutils-gdb/gdb/utils.c:396 0x55bec226beba _Z15internal_verrorPKciS0_P13__va_list_tag /home/uday/programs/binutils-gdb/gdb/utils.c:476 0x55bec23b9a9e _Z18internal_error_locPKciS0_z /home/uday/programs/binutils-gdb/gdbsupport/errors.cc:58 0x55bec21885a3 _ZNK4type5fieldEi /home/uday/programs/binutils-gdb/gdb/gdbtypes.h:985 0x55bec218ee19 _ZNK4type5fieldEi /home/uday/programs/binutils-gdb/gdb/symtab.h:1293 0x55bec218ee19 _Z13define_symbolmPKciiP7objfile /home/uday/programs/binutils-gdb/gdb/stabsread.c:1009 0x55bec1eeeead _Z18process_one_symboliimPKcRKSt6vectorImSaImEEP7objfile8language /home/uday/programs/binutils-gdb/gdb/dbxread.c:2838 0x55bec1eef566 read_ofile_symtab /home/uday/programs/binutils-gdb/gdb/dbxread.c:2287 0x55bec1eef566 dbx_expand_psymtab /home/uday/programs/binutils-gdb/gdb/dbxread.c:2137 0x55bec1eee124 _ZN14legacy_psymtab14expand_psymtabEP7objfile /home/uday/programs/binutils-gdb/gdb/psympriv.h:430 ... I poked around a bit, it seems like gdb is trying to parse the stab debugging info for f, which objdump tells me is this f:F(0,1)=@s8;-16; the semicolon at the end seems to confuse gdb. the following bit of code from gdb/stabsread.c indicates that this semicolon should be followed by some stuff specific to "Sun acc" (I assume this is some other compiler?) but that's clearly not the case here - we have *p == ';' in a file produced by gcc. should we have a condition stricter than *p == ';' for doing the Sun acc-specific stuff? is anyone familiar enough with Sun acc to give input on what the condition should be? /* fall into process_prototype_types. */ // note: *p is ';' here process_prototype_types: /* Sun acc puts declared types of arguments here. */ if (*p == ';') { ... BTW I know -gstabs+ is deprecated now and dwarves is preferred instead. I initially hit the bug when debugging an ancient binary and think it still might be worth fixing for similar use cases. -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2022-12-30 23:43 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-30 23:43 udaysha01 at gmail dot com [this message] 2022-12-31 1:45 ` [Bug symtab/29950] " tromey at sourceware dot org 2022-12-31 11:38 ` mark at klomp dot org
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-29950-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).