public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tui/26205] New: [tui] gdb aborts during winheight command
@ 2020-07-05 14:20 vries at gcc dot gnu.org
2020-07-05 14:21 ` [Bug tui/26205] " vries at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-05 14:20 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26205
Bug ID: 26205
Summary: [tui] gdb aborts during winheight command
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: tui
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
With test-case gdb.tui/new-layout.exp, I run into:
...
PASS: gdb.tui/new-layout.exp: horizontal display
ERROR: : spawn id exp48 not open
while executing
"expect {
-i exp48 -timeout 10
-re "^\[\x07\x08\x0a\x0d\]" {
scan $expect_out(0,string) %c val
set hexval [format "%02x" $val]
ver..."
("uplevel" body line 1)
invoked from within
"uplevel $body" NONE : spawn id exp48 not open
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)
...
This minimal example already aborts (though I'm not sure this is a correct
minimal representation of the problem described above):
...
$ gdb -tui -ex "winheight src - 5"
...
Aborted (core dumped)
L?? PC: ??
$
...
Backtrace:
...
#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 /home/vries/gdb_versions/devel/src/gdb/tui/tui-win.c:663
#3 0x000000000094a241 in tui_set_win_height_command (arg=0x7fffffffe1d8 "src -
5",
from_tty=1) at /home/vries/gdb_versions/devel/src/gdb/tui/tui-win.c:870
#4 0x00000000004f9abc in do_const_cfunc (c=0x122f470, args=0x7fffffffe1d8 "src
- 5",
from_tty=1) at /home/vries/gdb_versions/devel/src/gdb/cli/cli-decode.c:95
#5 0x00000000004fd171 in cmd_func (cmd=0x122f470, args=0x7fffffffe1d8 "src -
5", from_tty=1)
at /home/vries/gdb_versions/devel/src/gdb/cli/cli-decode.c:2181
#6 0x000000000090daf8 in execute_command (p=0x7fffffffe1de "5", from_tty=1)
at /home/vries/gdb_versions/devel/src/gdb/top.c:668
#7 0x000000000073c1c1 in catch_command_errors (
command=0x90d57f <execute_command(char const*, int)>,
arg=0x7fffffffe1ce "winheight src - 5", from_tty=1)
at /home/vries/gdb_versions/devel/src/gdb/main.c:457
#8 0x000000000073d598 in captured_main_1 (context=0x7fffffffdb60)
at /home/vries/gdb_versions/devel/src/gdb/main.c:1218
#9 0x000000000073d78d in captured_main (data=0x7fffffffdb60)
at /home/vries/gdb_versions/devel/src/gdb/main.c:1243
#10 0x000000000073d7f8 in gdb_main (args=0x7fffffffdb60)
at /home/vries/gdb_versions/devel/src/gdb/main.c:1268
#11 0x0000000000413d39 in main (argc=9, argv=0x7fffffffdc68)
at /home/vries/gdb_versions/devel/src/gdb/gdb.c:32
...
--
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 ` 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
end of thread, other threads:[~2020-07-06 7:57 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
2020-07-06 7:57 ` 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).