public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: gdb-prs@sourceware.org Subject: [Bug tui/26205] [tui] gdb aborts during winheight command Date: Mon, 06 Jul 2020 07:54:47 +0000 [thread overview] Message-ID: <bug-26205-4717-BsXE2ZvF1o@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-26205-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=26205 --- Comment #7 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=947f7597788b646683cb37b2833ed1844ce7d1bc commit 947f7597788b646683cb37b2833ed1844ce7d1bc Author: Tom de Vries <tdevries@suse.de> Date: Mon Jul 6 09:54:43 2020 +0200 [gdb/tui,c++17] Fix NULL string_view in tui_partial_win_by_name When building gdb with CFLAGS=-std=gnu17 and CXXFLAGS=-std=gnu++17 and running test-case gdb.tui/new-layout.exp, we run into: ... UNRESOLVED: gdb.tui/new-layout.exp: left window box after shrink (ll corner) FAIL: gdb.tui/new-layout.exp: right window box after shrink (ll corner) ... In a minimal form, we run into an abort when issuing a winheight command: ... $ gdb -tui -ex "winheight src - 5" <tui stuff> Aborted (core dumped) $ ... with this backtrace at the abort: ... \#0 0x0000000000438db0 in std::char_traits<char>::length (__s=0x0) at /usr/include/c++/9/bits/char_traits.h:335 \#1 0x000000000043b72e in std::basic_string_view<char, \ std::char_traits<char> >::basic_string_view (this=0x7fffffffd4f0, \ __str=0x0) at /usr/include/c++/9/string_view:124 \#2 0x000000000094971b in tui_partial_win_by_name (name="src") at src/gdb/tui/tui-win.c:663 ... due to a NULL comparison which constructs a string_view object from NULL: ... 657 /* Answer the window represented by name. */ 658 static struct tui_win_info * 659 tui_partial_win_by_name (gdb::string_view name) 660 { 661 struct tui_win_info *best = nullptr; 662 663 if (name != NULL) ... In gdbsupport/gdb_string_view.h, we either use: - gdb's copy of libstdc++-v3/include/experimental/string_view, or - the standard implementation of string_view, when built with C++17 or later (which in gcc's case comes from libstdc++-v3/include/std/string_view) In the first case, there's support for constructing a string_view from a NULL pointer: ... /*constexpr*/ basic_string_view(const _CharT* __str) : _M_len{__str == nullptr ? 0 : traits_type::length(__str)}, _M_str{__str} { } ... but in the second case, there's not: ... __attribute__((__nonnull__)) constexpr basic_string_view(const _CharT* __str) noexcept : _M_len{traits_type::length(__str)}, _M_str{__str} { } ... Fix this by removing the NULL comparison altogether. Build on x86_64-linux with CFLAGS=-std=gnu17 and CXXFLAGS=-std=gnu++17, and tested. gdb/ChangeLog: 2020-07-06 Tom de Vries <tdevries@suse.de> PR tui/26205 * tui/tui-win.c (tui_partial_win_by_name): Don't test for NULL name. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2020-07-06 7:54 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-05 14:20 [Bug tui/26205] New: " vries at gcc dot gnu.org 2020-07-05 14:21 ` [Bug tui/26205] " vries at gcc dot gnu.org 2020-07-05 15:54 ` vries at gcc dot gnu.org 2020-07-05 16:07 ` tromey at sourceware dot org 2020-07-05 16:09 ` tromey at sourceware dot org 2020-07-05 21:18 ` vries at gcc dot gnu.org 2020-07-05 21:41 ` vries at gcc dot gnu.org 2020-07-05 21:44 ` vries at gcc dot gnu.org 2020-07-06 7:54 ` cvs-commit at gcc dot gnu.org [this message] 2020-07-06 7:57 ` vries at gcc dot gnu.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-26205-4717-BsXE2ZvF1o@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).