public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30810] New: [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6
@ 2023-08-30  6:56 vries at gcc dot gnu.org
  2023-08-30 10:05 ` [Bug symtab/30810] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-30  6:56 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30810
           Summary: [gdb/symtab, stabs] gdbtypes.c:5596: internal-error:
                    Unexpected type field location kind: 6
           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: ---

When running test-case gdb.dwarf2/per-bfd-sharing.exp with make-check-all.sh, I
run into:
...
TARGET BOARD: stabs
ERROR: Could not resync from internal error (eof)
ERROR: GDB process no longer exists
FAIL: gdb.dwarf2/per-bfd-sharing.exp: first=index: second=readnow: third=index:
load third: file index (GDB internal error)
FAIL: gdb.dwarf2/per-bfd-sharing.exp: first=index: second=readnow:
third=readnow: load third: file readnow (GDB internal error)
FAIL: gdb.dwarf2/per-bfd-sharing.exp: first=index: second=readnow:
third=standard: load third: file (GDB internal error)
# of expected passes            259
# of unexpected core files      6
# of unexpected failures        3
# of unresolved testcases       11
...

In more detail, using c++filt:
...
(gdb) file
build/gdb/testsuite/outputs/gdb.dwarf2/per-bfd-sharing/per-bfd-sharing
Reading symbols from
build/gdb/testsuite/outputs/gdb.dwarf2/per-bfd-sharing/per-bfd-sharing...


Fatal signal: Segmentation fault
----- Backtrace -----
0x59cca0 gdb_internal_backtrace_1
        gdb/bt-utils.c:122
0x59cd43 gdb_internal_backtrace()
        gdb/bt-utils.c:168
0x790ce0 handle_fatal_signal
        gdb/event-top.c:889
0x790e4c handle_sigsegv
        gdb/event-top.c:962
0x7f91519d890f ???
       
/usr/src/debug/glibc-2.31-150300.52.2.x86_64/nptl/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x7f914f9cbdf7 __strlen_avx2
        ../sysdeps/x86_64/multiarch/strlen-avx2.S:100
0x14844ac xstrdup
        libiberty/xstrdup.c:33
0x7efa63 copy_type_recursive(type*, htab*)
        gdb/gdbtypes.c:5572
0xd1c7c3 value::preserve(objfile*, htab*)
        gdb/value.c:2388
0xd1ca39 preserve_values(objfile*)
        gdb/value.c:2448
0x9940e2 objfile::~objfile()
        gdb/objfiles.c:532
0x997ad5 std::default_delete<objfile>::operator()(objfile*) const
        /usr/include/c++/7/bits/unique_ptr.h:78
0x9974d2 std::unique_ptr<objfile, std::default_delete<objfile> >::~unique_ptr()
        /usr/include/c++/7/bits/unique_ptr.h:263
0x9fccc3 void __gnu_cxx::new_allocator<std::_List_node<std::unique_ptr<objfile,
std::default_delete<objfile> > > >::destroy<std::unique_ptr<objfile,
std::default_delete<objfile> > >(std::unique_ptr<objfile,
std::default_delete<objfile> >*)
        /usr/include/c++/7/ext/new_allocator.h:140
0x9fc682 void
std::allocator_traits<std::allocator<std::_List_node<std::unique_ptr<objfile,
std::default_delete<objfile> > > > >::destroy<std::unique_ptr<objfile,
std::default_delete<objfile> >
>(std::allocator<std::_List_node<std::unique_ptr<objfile,
std::default_delete<objfile> > > >&, std::unique_ptr<objfile,
std::default_delete<objfile> >*)
        /usr/include/c++/7/bits/alloc_traits.h:487
0x9fc269 std::__cxx11::list<std::unique_ptr<objfile,
std::default_delete<objfile> >, std::allocator<std::unique_ptr<objfile,
std::default_delete<objfile> > >
>::_M_erase(std::_List_iterator<std::unique_ptr<objfile,
std::default_delete<objfile> > >)
        /usr/include/c++/7/bits/stl_list.h:1815
0x9fbabd std::__cxx11::list<std::unique_ptr<objfile,
std::default_delete<objfile> >, std::allocator<std::unique_ptr<objfile,
std::default_delete<objfile> > >
>::erase(std::_List_const_iterator<std::unique_ptr<objfile,
std::default_delete<objfile> > >)
        /usr/include/c++/7/bits/list.tcc:157
0x9fa07d program_space::remove_objfile(objfile*)
        gdb/progspace.c:175
0x993f9f objfile::unlink()
        gdb/objfiles.c:470
0xbc8ab7 syms_from_objfile_1
        gdb/symfile.c:936
0xbc8c7b syms_from_objfile
        gdb/symfile.c:983
0xbc9176 symbol_file_add_with_addrs
        gdb/symfile.c:1086
0xbc9503 symbol_file_add_from_bfd(gdb::ref_ptr<bfd, gdb_bfd_ref_policy> const&,
char const*, enum_flags<symfile_add_flag>, std::vector<other_sections,
std::allocator<other_sections> >*, enum_flags<objfile_flag>, objfile*)
        gdb/symfile.c:1167
0xbc9552 symbol_file_add(char const*, enum_flags<symfile_add_flag>,
std::vector<other_sections, std::allocator<other_sections> >*,
enum_flags<objfile_flag>)
        gdb/symfile.c:1180
0xbc9617 symbol_file_add_main_1
        gdb/symfile.c:1203
0xbcab69 symbol_file_command(char const*, int)
        gdb/symfile.c:1681
0x793660 file_command
        gdb/exec.c:554
0x5f5856 do_simple_func
        gdb/cli/cli-decode.c:95
0x5fa86a cmd_func(cmd_list_element*, char const*, int)
        gdb/cli/cli-decode.c:2735
0xc3f91f execute_command(char const*, int)
        gdb/top.c:575
0x790499 command_handler(char const*)
        gdb/event-top.c:552
0x7909a1 command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char>
>&&)
        gdb/event-top.c:788
0xc6be4f tui_command_line_handler
        gdb/tui/tui-interp.c:104
0x78fdef gdb_rl_callback_handler
        gdb/event-top.c:259
0xd79293 rl_callback_read_char
        readline/readline/callback.c:290
0x78fc57 gdb_rl_callback_read_char_wrapper_noexcept
        gdb/event-top.c:195
0x78fcf3 gdb_rl_callback_read_char_wrapper
        gdb/event-top.c:234
0xc95597 stdin_event_handler
        gdb/ui.c:155
0x149fe51 handle_file_event
        gdbsupport/event-loop.cc:573
0x14a03e7 gdb_wait_for_event
        gdbsupport/event-loop.cc:694
0x149f2ad gdb_do_one_event(int)
        gdbsupport/event-loop.cc:264
0x8f869e start_event_loop
        gdb/main.c:412
0x8f87f8 captured_command_loop
        gdb/main.c:476
0x8f9fe4 captured_main
        gdb/main.c:1320
0x8fa07e gdb_main(captured_main_args*)
        gdb/main.c:1339
0x415f52 main
        gdb/gdb.c:39
---------------------
A fatal error internal to GDB has been detected, further
debugging is not possible.  GDB will now terminate.

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

ERROR: GDB process no longer exists
GDB process exited with wait status 3221 exp9 0 0 CHILDKILLED SIGSEGV
{segmentation violation}
...

When running from the command line instead:
...
$ gdb -q -batch -x outputs/gdb.dwarf2/per-bfd-sharing/gdb.in.26
...
I get:
...
/data/vries/gdb/src/gdb/gdbtypes.c:5596: internal-error: Unexpected type field
location kind: 6
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x59cca0 gdb_internal_backtrace_1
        /data/vries/gdb/src/gdb/bt-utils.c:122
0x59cd43 _Z22gdb_internal_backtracev
        /data/vries/gdb/src/gdb/bt-utils.c:168
0xce6b30 internal_vproblem
        /data/vries/gdb/src/gdb/utils.c:396
0xce6eff _Z15internal_verrorPKciS0_P13__va_list_tag
        /data/vries/gdb/src/gdb/utils.c:476
0x149ee84 _Z18internal_error_locPKciS0_z
        /data/vries/gdb/src/gdbsupport/errors.cc:58
0x7efc34 _Z19copy_type_recursiveP4typeP4htab
        /data/vries/gdb/src/gdb/gdbtypes.c:5595
...

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

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

* [Bug symtab/30810] [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6
  2023-08-30  6:56 [Bug symtab/30810] New: [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6 vries at gcc dot gnu.org
@ 2023-08-30 10:05 ` vries at gcc dot gnu.org
  2023-08-30 19:17 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-30 10:05 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 832b689cf03..65ce3a0f5a8 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -267,7 +267,7 @@ buildsym_compunit::finish_block_internal
              ftype->set_num_fields (nparams);
              ftype->set_fields
                ((struct field *)
-                TYPE_ALLOC (ftype, nparams * sizeof (struct field)));
+                TYPE_ZALLOC (ftype, nparams * sizeof (struct field)));

              iparams = 0;
              /* Here we want to directly access the dictionary, because
...

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

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

* [Bug symtab/30810] [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6
  2023-08-30  6:56 [Bug symtab/30810] New: [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6 vries at gcc dot gnu.org
  2023-08-30 10:05 ` [Bug symtab/30810] " vries at gcc dot gnu.org
@ 2023-08-30 19:17 ` vries at gcc dot gnu.org
  2023-08-31  7:37 ` cvs-commit at gcc dot gnu.org
  2023-08-31  7:39 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-30 19:17 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-August/202048.html

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

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

* [Bug symtab/30810] [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6
  2023-08-30  6:56 [Bug symtab/30810] New: [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6 vries at gcc dot gnu.org
  2023-08-30 10:05 ` [Bug symtab/30810] " vries at gcc dot gnu.org
  2023-08-30 19:17 ` vries at gcc dot gnu.org
@ 2023-08-31  7:37 ` cvs-commit at gcc dot gnu.org
  2023-08-31  7:39 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-31  7:37 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

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

commit 0b8b932dce26ef8e907b3b3c06b01a99420245fe
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Aug 31 09:37:44 2023 +0200

    [gdb/symtab] Fix uninitialized memory in
buildsym_compunit::finish_block_internal

    When running test-case gdb.dwarf2/per-bfd-sharing.exp with target board
stabs,
    gdb either segfaults or asserts due to reading uninitialized memory,
allocated
    here in buildsym_compunit::finish_block_internal:
    ...
                  ftype->set_fields
                    ((struct field *)
                     TYPE_ALLOC (ftype, nparams * sizeof (struct field)));
    ...

    Fix this by using TYPE_ZALLOC instead.

    Tested on x86_64-linux.

    Approved-By: Tom Tromey <tom@tromey.com>

    PR symtab/30810
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30810

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

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

* [Bug symtab/30810] [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6
  2023-08-30  6:56 [Bug symtab/30810] New: [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6 vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-08-31  7:37 ` cvs-commit at gcc dot gnu.org
@ 2023-08-31  7:39 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-31  7:39 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.1
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

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

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

end of thread, other threads:[~2023-08-31  7:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30  6:56 [Bug symtab/30810] New: [gdb/symtab, stabs] gdbtypes.c:5596: internal-error: Unexpected type field location kind: 6 vries at gcc dot gnu.org
2023-08-30 10:05 ` [Bug symtab/30810] " vries at gcc dot gnu.org
2023-08-30 19:17 ` vries at gcc dot gnu.org
2023-08-31  7:37 ` cvs-commit at gcc dot gnu.org
2023-08-31  7:39 ` vries at gcc dot gnu.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).