NetBSD Problem Report #55053

From dholland@macaran.eecs.harvard.edu  Sat Mar  7 10:45:14 2020
Return-Path: <dholland@macaran.eecs.harvard.edu>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C77301A9218
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  7 Mar 2020 10:45:14 +0000 (UTC)
Message-Id: <20200307104505.CD7546E2DC@macaran.eecs.harvard.edu>
Date: Sat,  7 Mar 2020 05:45:05 -0500 (EST)
From: dholland@eecs.harvard.edu
Reply-To: dholland@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: gdb chokes on shell syntax errors when running debuggee
X-Send-Pr-Version: 3.95

>Number:         55053
>Category:       toolchain
>Synopsis:       gdb chokes on shell syntax errors when running debuggee
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 07 10:50:00 +0000 2020
>Originator:     David Holland
>Release:        NetBSD 9.99.42 (20200126)
>Organization:
>Environment:
System: NetBSD macaran 9.99.42 NetBSD 9.99.42 (MACARAN) #58: Fri Feb 7 22:38:20 EST 2020 dholland@macaran:/usr/src/sys/arch/amd64/compile/MACARAN amd64
Architecture: x86_64
Machine: amd64
>Description:

gdb explodes if you try to pass a subprocess command line args that
contain shell syntax errors, e.g. unquoted parens or a dangling <.

>How-To-Repeat:

% gdb hello
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
   :
   :
   :
Reading symbols from foo...
(gdb) r abc (def)
Starting program: /tmp/foo/foo abc (def)
Badly placed ()'s.
/usr/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/target.c:2170: internal-error: void target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.

/usr/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/target.c:2170: internal-error: void target_mourn_inferior(ptid_t): Assertion `ptid == inferior_ptid' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n

Note that the problem is caused by the shell dying.

It is fairly easy to trigger this problem by accident if you happen to
have a file with parentheses in its name, because the readline tab
completion in gdb's command line will fill in the file's full name
without quoting or expanding the parentheses.

>Fix:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.