From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 123CC384AB48; Fri, 19 Apr 2024 08:14:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 123CC384AB48 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713514464; bh=Cx7T2nB2t71317N4JbdKQdsSRsB0jiSy8WWHi2pW+t0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eamnF8/lEEkJcihs9NxjBlGQKy83nkMUAGAu5IrA/RJXeouNJn7ngeYTfnX+TwrxV YvR8GQjWix+uwaujTUC8PG9VP1FMfT9iO0q0OS8AfK2M0b0uZ7rTMm3XvDQ3160AfN Jg05XlyhsRoryrHdvinE4qGt0yROn2pu5+ItJooE= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/31577] [gdb] terminate called after throwing an instance of 'gdb_exception_error' Date: Fri, 19 Apr 2024 08:14:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31577 --- Comment #3 from Tom de Vries --- Something like this fixes it: ... diff --git a/gdb/remote.c b/gdb/remote.c index 5c9fdebcdbe..3de4a0bae80 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -12574,8 +12574,20 @@ remote_target::remote_hostio_send_command (int command_bytes, int which_packet, return -1; } - putpkt_binary (rs->buf.data (), command_bytes); - bytes_read =3D getpkt (&rs->buf); + try + { + putpkt_binary (rs->buf.data (), command_bytes); + bytes_read =3D getpkt (&rs->buf); + } + catch (const gdb_exception &ex) + { + if (ex.error =3D=3D TARGET_CLOSE_ERROR) + { + *remote_errno =3D FILEIO_EIO; + return -1; + } + throw; + } /* If it timed out, something is wrong. Don't try to parse the buffer. */ ... But it remains unclear to me at what point exactly we should catch this. Here? Down in getpkt? Up in detach_command? --=20 You are receiving this mail because: You are on the CC list for the bug.=