From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by sourceware.org (Postfix) with ESMTPS id 0C22C3858C50 for ; Tue, 12 Sep 2023 16:27:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0C22C3858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-792623074edso165335439f.1 for ; Tue, 12 Sep 2023 09:27:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1694536070; x=1695140870; darn=sourceware.org; h=to:content-transfer-encoding:mime-version:message-id:date:subject :from:from:to:cc:subject:date:message-id:reply-to; bh=4NlwmfI6it7A7N/RPlm20CLWdDwi+JZ+D0orox0sQ5E=; b=AIFj5HezGw+PVU2olb/egohHhvvaWgUUoUxzoXUwZGZywyukRgVIZsGSbHDzalQ/TI vJmPGZ04fZqNW576bJ6oWDfB824uFC+eYoiAumgXhkzPI7+7QpboLM79x+cNruPYe7qj eVdcTq9KPXfOSaqRf1MwZIyjo1gfLtCj7qIJ12J78vG5K51ISWGqL45Fb6ukJn5VJ4cz 27Vn1PK+we92FJwZQwokouC+4ecESUt9MPmCjoH4LcXwi/RTG+yV+npyuh5Cikd1VwuZ WtGqixxBQ7w25Mux4m/vjqjIilPzclyZebVlNDBvj7aqL99vxktl3jAK7YoZyWfVJ8j1 XDHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694536070; x=1695140870; h=to:content-transfer-encoding:mime-version:message-id:date:subject :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4NlwmfI6it7A7N/RPlm20CLWdDwi+JZ+D0orox0sQ5E=; b=igLMKkYIi8dbhTHGfiRlklfw0qmP13lVpGajFc34qp2UIRiT/IUSAoA3eYPN7+0jOd R9pnmqXci/wP0p7b65PR9atZMqDGRAg51OKxZw6ck7DaS9yMNGy7nIP03G7uwdTONOdF BqHa79UtdYPyC6i1ocj8XZbwki+hTEPhUYAgD1Bl32487DUsU4zO/Gvlivcr6jCLQp6I ma/qOtbxmm+ofLxaGzVhu5Bqa/cVLP3RpBBPnh571Hprw+LTDsvedWnisZ6u8qpB+qNJ I+CVwsw/IqtERXSnalQG6732yG3AHCPqdAPhlSNZbHv31P3oWtIf0H/+Gwhzy2DlqItE dx1Q== X-Gm-Message-State: AOJu0Yy211nAYgV/phjK3Yd+lWRxmfJ75mU2HIdklty2+FnIPDO/6xi7 atJDBMhP624wbllCFM90z8cEmhY1u2qt7rcLHKIvjg== X-Google-Smtp-Source: AGHT+IFLZ6tCPb64yST8XkCae2/hhnB2RzxHY8lOUzavcGuA8E9/72JH/h0DYti4UUFzyZWXdRu1qA== X-Received: by 2002:a05:6e02:1a29:b0:34f:89bf:98f5 with SMTP id g9-20020a056e021a2900b0034f89bf98f5mr3026062ile.3.1694536070199; Tue, 12 Sep 2023 09:27:50 -0700 (PDT) Received: from localhost.localdomain (71-211-130-31.hlrn.qwest.net. [71.211.130.31]) by smtp.gmail.com with ESMTPSA id l1-20020a02cd81000000b0042b91ec7e31sm2872324jap.3.2023.09.12.09.27.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 09:27:49 -0700 (PDT) From: Tom Tromey Subject: [PATCH 0/6] Fix error messages from serial code Date: Tue, 12 Sep 2023 10:27:47 -0600 Message-Id: <20230912-serial-exceptions-v1-0-af5097485390@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAIORAGUC/x2MQQrCQAwAv1JyNrBZF4t+RTyka7QBXUtSpFD6d 1OPAzOzgoupOFy6FUy+6vppAXTooI7cnoJ6D4ac8jGdKePu8wtlqTLNITumnlI5lSI9EUQ3mTx 0+T+vt+CBXXAwbnXcT2/2WQy27QfPYW/nfAAAAA== To: gdb-patches@sourceware.org X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Internal AdaCore testing on a Windows host with a target running on qemu revealed that remote.c could sometimes display random error messages. For example, different runs of the same test might display: Remote communication error. Target disconnected.: Arg list too long. Remote communication error. Target disconnected.: No error. Remote communication error. Target disconnected.: Not a directory. I looked into this and this series is the result. It's hard to be sure that this completely solves the problem -- there are a lot of code paths and the errors aren't very reproducible -- but it helps. Regression tested using native-extended-gdbserver on x86-64 Fedora 36. --- Tom Tromey (6): Fix latent bug in ser_windows_send_break Introduce throw_winerror_with_name Change serial_setbaudrate to throw exception Change serial "open" functions to throw exception Change serial_send_break and serial_write to throw Change serial_readchar to throw gdb/nat/windows-nat.c | 6 +-- gdb/remote.c | 106 +++++++++++++++++++++++++++---------------------- gdb/ser-base.c | 12 +++--- gdb/ser-base.h | 6 +-- gdb/ser-event.c | 4 +- gdb/ser-mingw.c | 86 ++++++++++++++++++--------------------- gdb/ser-pipe.c | 12 +++--- gdb/ser-tcp.c | 93 ++++++++++++++++++++++++------------------- gdb/ser-tcp.h | 4 +- gdb/ser-uds.c | 36 ++++++++--------- gdb/ser-unix.c | 57 ++++++++++++-------------- gdb/serial.c | 44 ++++++++------------ gdb/serial.h | 22 +++++----- gdb/windows-nat.c | 31 +++++++++------ gdbserver/win32-low.cc | 11 +++-- gdbsupport/errors.cc | 8 ++++ gdbsupport/errors.h | 7 ++++ 17 files changed, 279 insertions(+), 266 deletions(-) --- base-commit: d1722abe60ca7c330210aa97c8ec52ff98644206 change-id: 20230912-serial-exceptions-07104644e711 Best regards, -- Tom Tromey