* [Bug tui/26205] [tui] gdb aborts during winheight command
2020-07-05 14:20 [Bug tui/26205] New: [tui] gdb aborts during winheight command vries at gcc dot gnu.org
@ 2020-07-05 14:21 ` vries at gcc dot gnu.org
2020-07-05 15:54 ` vries at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-05 14:21 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26205
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tui/26205] [tui] gdb aborts during winheight command
2020-07-05 14:20 [Bug tui/26205] New: [tui] gdb aborts during winheight command 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
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-05 15:54 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26205
--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, this is during testing the tentative patch for PR26187, doesn't reproduce
with master. Perhaps this is normally hidden?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tui/26205] [tui] gdb aborts during winheight command
2020-07-05 14:20 [Bug tui/26205] New: [tui] gdb aborts during winheight command 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
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tromey at sourceware dot org @ 2020-07-05 16:07 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26205
--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
C++17 string_view doesn't allow NULL, and I am going to guess
that this:
static struct tui_win_info *
tui_partial_win_by_name (gdb::string_view name)
{
struct tui_win_info *best = nullptr;
if (name != NULL)
... perhaps constructs a string_view from NULL to do the
comparison? I looked at the callers and I don't see how
they could pass in NULL here...
Anyway, if so, the fix is to remove this "if".
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tui/26205] [tui] gdb aborts during winheight command
2020-07-05 14:20 [Bug tui/26205] New: [tui] gdb aborts during winheight command vries at gcc dot gnu.org
` (2 preceding siblings ...)
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
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: tromey at sourceware dot org @ 2020-07-05 16:09 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26205
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
FWIW I think there's still a real danger that other spots
pass NULL to string_view. Maybe as a temporary measure we
should simply always use gdb::string_view. Or maybe adding
some asserts and then running the test suite would flush
them all out.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tui/26205] [tui] gdb aborts during winheight command
2020-07-05 14:20 [Bug tui/26205] New: [tui] gdb aborts during winheight command vries at gcc dot gnu.org
` (3 preceding siblings ...)
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
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-05 21:18 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26205
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, chronicle of a bug foretold:
...
commit 5ac588997c3c2d032d5d5145d9245eb37354c23b
Author: Tom Tromey <tromey@adacore.com>
Date: Tue Jun 30 07:53:03 2020 -0600
...
(Note that the build still is not clean; and also I noticed that the
libstdc++ string_view forbids the use of nullptr ... I wonder if gdb
violates that.)
...
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tui/26205] [tui] gdb aborts during winheight command
2020-07-05 14:20 [Bug tui/26205] New: [tui] gdb aborts during winheight command vries at gcc dot gnu.org
` (4 preceding siblings ...)
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
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-05 21:41 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26205
--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #2)
> C++17 string_view doesn't allow NULL, and I am going to guess
> that this:
>
> static struct tui_win_info *
> tui_partial_win_by_name (gdb::string_view name)
> {
> struct tui_win_info *best = nullptr;
>
> if (name != NULL)
>
>
> ... perhaps constructs a string_view from NULL to do the
> comparison? I looked at the callers and I don't see how
> they could pass in NULL here...
>
> Anyway, if so, the fix is to remove this "if".
Patch to that effect submitted:
https://sourceware.org/pipermail/gdb-patches/2020-July/170156.html
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tui/26205] [tui] gdb aborts during winheight command
2020-07-05 14:20 [Bug tui/26205] New: [tui] gdb aborts during winheight command vries at gcc dot gnu.org
` (5 preceding siblings ...)
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
2020-07-06 7:57 ` vries at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-05 21:44 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26205
--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> Hmm, this is during testing the tentative patch for PR26187, doesn't
> reproduce with master. Perhaps this is normally hidden?
So, FTR, this was wrong, it does reproduce with master, but only with
CXXFLAGS=-std=gnu++17.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tui/26205] [tui] gdb aborts during winheight command
2020-07-05 14:20 [Bug tui/26205] New: [tui] gdb aborts during winheight command vries at gcc dot gnu.org
` (6 preceding siblings ...)
2020-07-05 21:44 ` vries at gcc dot gnu.org
@ 2020-07-06 7:54 ` cvs-commit at gcc dot gnu.org
2020-07-06 7:57 ` vries at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-06 7:54 UTC (permalink / raw)
To: gdb-prs
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.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tui/26205] [tui] gdb aborts during winheight command
2020-07-05 14:20 [Bug tui/26205] New: [tui] gdb aborts during winheight command vries at gcc dot gnu.org
` (7 preceding siblings ...)
2020-07-06 7:54 ` cvs-commit at gcc dot gnu.org
@ 2020-07-06 7:57 ` vries at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-06 7:57 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26205
Tom de Vries <vries at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Target Milestone|--- |10.1
Status|NEW |RESOLVED
--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed, marking resolved-fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread