Bug 1912985

Summary: Abort after tab-completing a print variable
Product: [Fedora] Fedora Reporter: Ivan Molodetskikh <yalterz>
Component: gdbAssignee: Kevin Buettner <kevinb>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jan.kratochvil, keiths, kevinb, pmuldoon, sergiodj
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: gdb-10.1-7.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-24 22:04:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
bt full none

Description Ivan Molodetskikh 2021-01-05 18:07:11 UTC
Created attachment 1744665 [details]
bt full

I was inspecting a gnome-shell core and wanted to print a variable. I tab-completed it, some warning got printed, then Enter aborted gdb.

gdb-10.1-2.fc34.x86_64

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1  0x00007fece54db8a4 in __GI_abort () at abort.c:79
#2  0x000055ebffc6c6f8 in std::__replacement_assert (__file=__file@entry=0x55ec00263438 "/usr/include/c++/11/string_view", __line=__line@entry=211, 
    __function=__function@entry=0x55ec002632e0 "constexpr const value_type& std::basic_string_view<_CharT, _Traits>::operator[](std::basic_string_view<_CharT, _Traits>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; std::ba"..., __condition=__condition@entry=0x55ec00264cbe "__pos < this->_M_len") at /usr/include/c++/11/x86_64-redhat-linux/bits/c++config.h:2624
#3  0x000055ebffc729b7 in std::basic_string_view<char, std::char_traits<char> >::operator[] (this=<synthetic pointer>, __pos=0) at /usr/include/c++/11/string_view:211
#4  std::basic_string_view<char, std::char_traits<char> >::operator[] (__pos=0, this=<synthetic pointer>) at /usr/include/c++/11/string_view:209
#5  ada_lookup_name_info::ada_lookup_name_info (this=0x7ffc2602b2b8, lookup_name=...) at ../../gdb/ada-lang.c:13595
#6  0x000055ebffc74cc8 in gdb::optional<ada_lookup_name_info>::emplace<lookup_name_info const&> (this=0x7ffc2602b2b8) at ../../gdb/../gdbsupport/gdb_optional.h:155
#7  lookup_name_info::maybe_init<gdb::optional<ada_lookup_name_info>>(gdb::optional<ada_lookup_name_info>&) const (field=..., this=0x7ffc2602b2a0) at ../../gdb/symtab.h:312
#8  lookup_name_info::ada (this=0x7ffc2602b2a0) at ../../gdb/symtab.h:277
#9  ada_symbol_name_matches (symbol_search_name=0x55ec025a0350 "annobin_abi_note.c.exit", lookup_name=..., comp_match_res=0x55ec11875f10) at ../../gdb/ada-lang.c:13658
#10 0x000055ec0001e119 in compare_symbol_name (match_res=..., lookup_name=..., symbol_language=<optimized out>, symbol_name=0x55ec025a0350 "annobin_abi_note.c.exit") at ../../gdb/symtab.c:5264
#11 completion_list_add_name (tracker=..., symbol_language=<optimized out>, symname=0x55ec025a0350 "annobin_abi_note.c.exit", lookup_name=..., text=0x7ffc2602b530 "", word=0x7ffc2602b530 "") at ../../gdb/symtab.c:5280
#12 0x000055ec0001ebf8 in completion_list_add_msymbol (word=0x7ffc2602b530 "", text=0x7ffc2602b530 "", lookup_name=..., sym=0x55ec026505a0, tracker=...) at ../../gdb/symtab.c:5352
#13 default_collect_symbol_completion_matches_break_on (tracker=..., mode=<optimized out>, name_match_type=<optimized out>, text=<optimized out>, word=<optimized out>, break_on=<optimized out>, code=<optimized out>)
    at ../../gdb/symtab.c:5695
#14 0x000055ec0001f4c4 in language_defn::collect_symbol_completion_matches (code=TYPE_CODE_UNDEF, word=0x7ffc2602b410 "\020_\207\021\354U", text=0x7ffc2602b530 "", name_match_type=symbol_name_match_type::EXPRESSION, 
    mode=complete_symbol_mode::EXPRESSION, tracker=..., this=<optimized out>) at ../../gdb/language.h:475
#15 collect_symbol_completion_matches (tracker=..., mode=mode@entry=complete_symbol_mode::EXPRESSION, name_match_type=name_match_type@entry=symbol_name_match_type::EXPRESSION, text=text@entry=0x7ffc2602b530 "", 
    word=word@entry=0x7ffc2602b530 "") at ../../gdb/symtab.c:5819
#16 0x000055ebffd4cee7 in complete_files_symbols (word=0x7ffc2602b530 "", text=<optimized out>, tracker=...) at ../../gdb/completer.c:614
#17 complete_expression (tracker=..., text=0x7ffc2602b522 "configuration ", word=0x7ffc2602b530 "") at ../../gdb/completer.c:1182
#18 0x000055ebfff1bdc3 in print_command_completer (ignore=0x55ec02437b90, tracker=..., text=<optimized out>) at ../../gdb/printcmd.c:1241
#19 0x000055ebffd4acfd in complete_line_internal_1 (tracker=..., text=<optimized out>, line_buffer=<optimized out>, point=<optimized out>, reason=handle_brkchars) at ../../gdb/completer.c:1537
#20 0x000055ebffd4ad46 in complete_line_internal (tracker=..., text=<optimized out>, line_buffer=<optimized out>, point=<optimized out>, reason=<optimized out>) at ../../gdb/completer.c:1556
#21 0x000055ebffd4b7b6 in gdb_completion_word_break_characters_throw () at ../../gdb/completer.c:2012
#22 gdb_completion_word_break_characters () at ../../gdb/completer.c:2050
#23 0x00007fece63fa08a in _rl_find_completion_word (fp=fp@entry=0x7ffc2602b678, dp=dp@entry=0x7ffc2602b67c) at ../complete.c:1076
#24 0x00007fece63ff67c in rl_complete_internal (what_to_do=9) at ../complete.c:2007
#25 0x00007fece63f70e7 in _rl_dispatch_subseq (key=9, map=<optimized out>, got_subseq=<optimized out>) at ../readline.c:852
#26 0x00007fece63f7605 in _rl_dispatch (key=<optimized out>, map=<optimized out>) at ../readline.c:798
#27 0x00007fece63f80a5 in readline_internal_char () at ../readline.c:632
#28 0x00007fece641a225 in rl_callback_read_char () at ../callback.c:262
#29 0x000055ebffde4d86 in gdb_rl_callback_read_char_wrapper_noexcept () at ../../gdb/event-top.c:178
#30 0x000055ebffde59f4 in gdb_rl_callback_read_char_wrapper (client_data=<optimized out>) at ../../gdb/event-top.c:194
#31 0x000055ebffde4b68 in stdin_event_handler (error=<optimized out>, client_data=0x55ec02236ec0) at ../../gdb/event-top.c:519
#32 0x000055ec00226686 in gdb_wait_for_event (block=block@entry=0) at ../../gdbsupport/event-loop.cc:673
#33 0x000055ec0022693a in gdb_wait_for_event (block=0) at ../../gdbsupport/event-loop.cc:569
#34 gdb_do_one_event () at ../../gdbsupport/event-loop.cc:190
#35 0x000055ebffeaaab5 in start_event_loop () at ../../gdb/main.c:356
#36 captured_command_loop () at ../../gdb/main.c:416
#37 0x000055ebffead525 in captured_main (data=<optimized out>) at ../../gdb/main.c:1299
#38 gdb_main (args=<optimized out>) at ../../gdb/main.c:1314
#39 0x000055ebffc55290 in main (argc=<optimized out>, argv=<optimized out>) at ../../gdb/gdb.c:40

Comment 1 Kevin Buettner 2021-01-06 21:49:26 UTC
(In reply to Ivan Molodetskikh from comment #0)

> I was inspecting a gnome-shell core and wanted to print a variable. I
> tab-completed it, some warning got printed, then Enter aborted gdb.

Do you recall the string you entered which you then tried to tab-complete?

Do you know if this problem is reproducible without the core file?

Comment 2 Ivan Molodetskikh 2021-01-07 07:52:45 UTC
I tried reproducing it the same way I got the crash with the same core file, but I couldn't get the crash again. The interaction was something like

up
up
up
p con<Tab><Tab>
Display all 200 possibilities? n
p conf<Tab><Tab>

At this point it printed something weird into the output and pressing Enter lead to an abort. However, when I try this now "p conf<Tab><Tab>" works as intended (shows a few things starting with conf).

Comment 3 Ben Cotton 2021-02-09 15:37:09 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 4 Kevin Buettner 2021-02-11 17:23:23 UTC
I'm able to reproduce this bug now.  I'm working on a fix...

Comment 5 Kevin Buettner 2021-02-17 16:34:50 UTC
I believe that this patch...

https://sourceware.org/pipermail/gdb-patches/2021-February/175976.html

...fixes this bug.  I'm still waiting for it to be reviewed.

Comment 6 Kevin Buettner 2021-02-18 01:23:30 UTC
I'm changing the version back to 'rawhide' since the problem requires that the build use -D_GLIBCXX_DEBUG in the CFLAGS in order to trigger the assertion failure.  This only happens in rawhide gdb releases.  (I've tested the gdb binary from gdb-10.1-4.fc34.x86_64 and cannot reproduce the problem.)

Comment 7 Kevin Buettner 2021-02-24 22:04:12 UTC
Patch mentioned in comment 5 has been applied and the rawhide package has been successfully rebuilt.  I'm closing this bug.

Comment 8 Fedora Update System 2021-03-03 04:41:09 UTC
FEDORA-2021-41af532e06 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-41af532e06

Comment 9 Fedora Update System 2021-03-03 15:46:50 UTC
FEDORA-2021-41af532e06 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-41af532e06`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-41af532e06

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2021-03-19 17:43:53 UTC
FEDORA-2021-41af532e06 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Fedora Update System 2021-03-19 19:59:54 UTC
FEDORA-2021-41af532e06 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.