Package: gdb
Version: 13.1-3
Severity: normal
X-Debbugs-Cc: duncan82...@live.ca

Dear Maintainer,

I have a small project built with C and Rust using Meson. When I build
the project and try to set a breakpoint with tab-completion, GDB exits
with a std::length_error, seemingly only for some symbols.

I can't produce it with a Cargo-built program, but I can with a skeleton
Meson project, which I'll refer to for the rest of this report:

    $ mkdir proj  # or whatever
    $ cd $_
    $ meson init -l rust
    [...]
    $ meson setup build
    [...]
    $ meson compile -C build
    [...]
    $ gdb ./build/proj
    [...]
    warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
    of file /tmp/proj/build/proj.
    (gdb) b q<Tab>
*** nothing happens, just beeping
*** (if target is run first, includes e.g. 'qsort')
    (gdb) b a<Tab><Tab>
    Display all 145 possibilities? (y or n) y
    [... symbols, including 'abbrev.rs' and
         'alloc::alloc::box_free::h293b7814a118f9bc' ...]
    (gdb) b c<Tab>
    terminate called after throwing an instance of 'std::length_error'
      what():  basic_string::_M_replace


    Fatal signal: Aborted
    ----- Backtrace -----
    [below]
    ---------------------
    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/>.

    Aborted (core dumped)

The executable does work in lldb. Most of the rest of GDB probably
works, too; the completion seems to be the only broken thing.

A bunch of letters aside from 'c' (e.g. 'l', 'w') also crash; my guess
is that there's a bunch of functions that mess GDB up, and they're in
core:: or similar.

I'm running rustc from rustup, version
    rustc 1.72.0-nightly (d59363ad0 2023-06-01)
I originally found it with
    rustc 1.71.0-nightly (5ea3f0ae0 2023-05-23)

I've attached the backtrace below; my apologies for the missing symbols
before the abort(). It seems to be in a C++ destructor, but I can't
figure out which (or which package provides the symbols in question.)

----- Backtrace -----
0x55f3d0ab340e gdb_internal_backtrace_1
        /build/gdb-kUlB6r/gdb-13.1/gdb/bt-utils.c:122
0x55f3d0ab340e _Z22gdb_internal_backtracev
        /build/gdb-kUlB6r/gdb-13.1/gdb/bt-utils.c:168
0x55f3d0bbc601 handle_fatal_signal
        /build/gdb-kUlB6r/gdb-13.1/gdb/event-top.c:956
0x7fbab3a5af8f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7fbab3aa9ccc __pthread_kill_implementation
        ./nptl/pthread_kill.c:44
0x7fbab3a5aef1 __GI_raise
        ../sysdeps/posix/raise.c:26
0x7fbab3a45471 __GI_abort
        ./stdlib/abort.c:79
0x7fbab3c9d918 ???
0x7fbab3ca8e19 ???
0x7fbab3ca7e88 ???
0x7fbab3ca85a5 ???
0x7fbab49ce933 ???
0x7fbab49cf38c ???
0x55f3d09f9f49 _ZNKSt14default_deleteI13location_specEclEPS0_
        /usr/include/c++/12/bits/unique_ptr.h:95
0x55f3d09f9f49 _ZNSt10unique_ptrI13location_specSt14default_deleteIS0_EED4Ev
        /usr/include/c++/12/bits/unique_ptr.h:396
0x55f3d09f9f49 
_Z18location_completerP16cmd_list_elementR18completion_trackerPKcS4_
        /build/gdb-kUlB6r/gdb-13.1/gdb/completer.c:1042
0x55f3d0b131ca complete_line_internal_1
        /build/gdb-kUlB6r/gdb-13.1/gdb/completer.c:1438
0x55f3d0b13245 complete_line_internal
        /build/gdb-kUlB6r/gdb-13.1/gdb/completer.c:1457
0x55f3d0b1339a gdb_completion_word_break_characters_throw
        /build/gdb-kUlB6r/gdb-13.1/gdb/completer.c:1907
0x55f3d0b1339a _Z36gdb_completion_word_break_charactersv
        /build/gdb-kUlB6r/gdb-13.1/gdb/completer.c:1945
0x7fbab4c3dec5 _rl_find_completion_word
        ./complete.c:1091
0x7fbab4c3f263 rl_complete_internal
        ./complete.c:2027
0x7fbab4c3443f _rl_dispatch_subseq
        ./readline.c:916
0x7fbab4c34a8c readline_internal_char
        ./readline.c:675
0x7fbab4c52644 rl_callback_read_char
        ./callback.c:272
0x55f3d0bbd7fd gdb_rl_callback_read_char_wrapper_noexcept
        /build/gdb-kUlB6r/gdb-13.1/gdb/event-top.c:188
0x55f3d0bbd98f gdb_rl_callback_read_char_wrapper
        /build/gdb-kUlB6r/gdb-13.1/gdb/event-top.c:221
0x55f3d0bbcd0c stdin_event_handler
        /build/gdb-kUlB6r/gdb-13.1/gdb/event-top.c:541
0x55f3d0fa41d5 gdb_wait_for_event
        /build/gdb-kUlB6r/gdb-13.1/gdbsupport/event-loop.cc:716
0x55f3d0fa4cb2 _Z16gdb_do_one_eventi
        /build/gdb-kUlB6r/gdb-13.1/gdbsupport/event-loop.cc:264
0x55f3d0c862f9 start_event_loop
        /build/gdb-kUlB6r/gdb-13.1/gdb/main.c:411
0x55f3d0c862f9 captured_command_loop
        /build/gdb-kUlB6r/gdb-13.1/gdb/main.c:471
0x55f3d0c87f74 captured_main
        /build/gdb-kUlB6r/gdb-13.1/gdb/main.c:1330
0x55f3d0c87f74 _Z8gdb_mainP18captured_main_args
        /build/gdb-kUlB6r/gdb-13.1/gdb/main.c:1345
0x55f3d0a16ca9 main
        /build/gdb-kUlB6r/gdb-13.1/gdb/gdb.c:32
---------------------


-- System Information:
Debian Release: 12.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-9-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_CA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gdb depends on:
ii  libbabeltrace1          1.5.11-1+b2
ii  libc6                   2.36-9
ii  libdebuginfod1          0.188-2.1
ii  libexpat1               2.5.0-1
ii  libgcc-s1               12.2.0-14
ii  libgmp10                2:6.2.1+dfsg1-1.1
ii  libipt2                 2.0.5-1
ii  liblzma5                5.4.1-0.2
ii  libmpfr6                4.2.0-1
ii  libncursesw6            6.4-4
ii  libpython3.11           3.11.2-6
ii  libreadline8            8.2-1.3
ii  libsource-highlight4v5  3.1.9-4.2+b3
ii  libstdc++6              12.2.0-14
ii  libtinfo6               6.4-4
ii  libxxhash0              0.8.1-1
ii  libzstd1                1.5.4+dfsg2-5
ii  zlib1g                  1:1.2.13.dfsg-1

Versions of packages gdb recommends:
ii  libc6-dbg [libc-dbg]  2.36-9

Versions of packages gdb suggests:
pn  gdb-doc    <none>
pn  gdbserver  <none>

-- no debconf information

Reply via email to