From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id 57DAC3858D3C for ; Mon, 28 Aug 2023 17:14:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 57DAC3858D3C 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-il1-x12b.google.com with SMTP id e9e14a558f8ab-34ba9d6f033so12193215ab.2 for ; Mon, 28 Aug 2023 10:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1693242866; x=1693847666; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=VkvlIpEygiGQIld6x0CSJH6ITTCDt8hyrgVnT6ByER0=; b=aJwSeG/uwO2YMqeksPguW7gJVsZcq6/KKx1OThJqd+YxUlgvCVq66lFdyOc9gQg5wI 3gwMQaDhRNsb+BtDHvwVWoOAoBQyHmVBH/DP8QtELVgBNKI2NUybJK7K3BMdye+0b84R vzmfWFSqAwaZNH+cLpcnvjhyB44RhGcdSnGboDD3VTRHWmMIGQ74mvQymm/BS+mTXnYS tUdwCFWXYoFdY3lr67hfcycYS0MYL7BXyLRe6SrUNq94fD9PsGE7jYOuaKYneHVaIBLX 9ON9Z4+ZrVUkXLvP91X71wdmW5eny8GspbWGESo3mfEQVPi3ZFhrJGufDz8VPIT3TXMl iZHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693242866; x=1693847666; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VkvlIpEygiGQIld6x0CSJH6ITTCDt8hyrgVnT6ByER0=; b=UElUuUvsg/arf/JBn83V+vv8jjiJUPs/SM/FbXcbC7WXixYzS4VcXcIsfxnrmxSSvE KzyITxT9NNj3NIgY1VK28+Xkb7581pL+h35wrQW12oe+iX1l/npbwj6GQO4qQptUGRvo oa/9GTasZeEvcnOJYSvmZtQ3IKzay5XQD/BSBMntbAR4En39h8pfEAV95OoNFWlld1WT QMGhoOAnJ8f5koUCeNiFuSr52pqNsOWhL1TKuC4QryV3+iSjuPY32yH4oH2zwoHGka3n +R/OIO3DD/sHX6Kpn+r6hVtt+n+Fk6qWYj2s9tNSCxVSYXdtMGUW6zG4i2xGrmdudH2V 3W9Q== X-Gm-Message-State: AOJu0Yz8E1Q0YMvy+CiM82eixuq04cD8oTRS9mr5rPudmn4qqhsw1XOf mqdsvw6lF2sfNuvtsTI/9dJmrppwwLBJSSEz4qjKYg== X-Google-Smtp-Source: AGHT+IGZGy9mypxKRnOjQraZnP4JVh30dTZWcHBjQkLDZIT2BBF+mI50eia0mbpmW6nV19hET3tIUg== X-Received: by 2002:a05:6e02:b41:b0:34c:cb32:f799 with SMTP id f1-20020a056e020b4100b0034ccb32f799mr18796522ilu.22.1693242866607; Mon, 28 Aug 2023 10:14:26 -0700 (PDT) Received: from localhost.localdomain (75-166-150-212.hlrn.qwest.net. [75.166.150.212]) by smtp.gmail.com with ESMTPSA id go7-20020a0566382c8700b0042ad887f705sm2613249jab.143.2023.08.28.10.14.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Aug 2023 10:14:26 -0700 (PDT) From: Tom Tromey Date: Mon, 28 Aug 2023 11:14:25 -0600 Subject: [PATCH 4/4] Unify getpkt and getpkt_or_notif_sane MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230828-getpkt-cleanup-v1-4-0f3da220530c@adacore.com> References: <20230828-getpkt-cleanup-v1-0-0f3da220530c@adacore.com> In-Reply-To: <20230828-getpkt-cleanup-v1-0-0f3da220530c@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: getpkt and getpkt_or_notif_sane are just wrappers for getpkt_or_notif_sane_1. This patch adds the is_notif parameter to getpkt, with a suitable default, and removes the wrappers. --- gdb/remote.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index 88c422b0c63..edda9457745 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -1213,11 +1213,7 @@ class remote_target : public process_stratum_target void skip_frame (); long read_frame (gdb::char_vector *buf_p); - int getpkt_or_notif_sane_1 (gdb::char_vector *buf, bool forever, - bool *is_notif); - int getpkt (gdb::char_vector *buf, bool forever); - int getpkt_or_notif_sane (gdb::char_vector *buf, bool forever, - bool *is_notif); + int getpkt (gdb::char_vector *buf, bool forever, bool *is_notif = nullptr); int remote_vkill (int pid); void remote_kill_k (); @@ -8297,7 +8293,7 @@ remote_target::wait_ns (ptid_t ptid, struct target_waitstatus *status, /* If in non-stop mode, get out of getpkt even if a notification is received. */ - ret = getpkt_or_notif_sane (&rs->buf, false /* forever */, &is_notif); + ret = getpkt (&rs->buf, false /* forever */, &is_notif); while (1) { if (ret != -1 && !is_notif) @@ -8336,7 +8332,7 @@ remote_target::wait_ns (ptid_t ptid, struct target_waitstatus *status, } /* Otherwise do a blocking wait. */ - ret = getpkt_or_notif_sane (&rs->buf, true /* forever */, &is_notif); + ret = getpkt (&rs->buf, true /* forever */, &is_notif); } } @@ -8391,7 +8387,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status, However, before we do that we need to ensure that the caller knows how to take the target into/out of async mode. */ bool is_notif; - int ret = getpkt_or_notif_sane (&rs->buf, forever, &is_notif); + int ret = getpkt (&rs->buf, forever, &is_notif); /* GDB gets a notification. Return to core as this event is not interesting. */ @@ -10056,9 +10052,7 @@ show_watchdog (struct ui_file *file, int from_tty, packet). */ int -remote_target::getpkt_or_notif_sane_1 (gdb::char_vector *buf, - bool forever, - bool *is_notif) +remote_target::getpkt (gdb::char_vector *buf, bool forever, bool *is_notif) { struct remote_state *rs = get_remote_state (); int c; @@ -10195,25 +10189,6 @@ remote_target::getpkt_or_notif_sane_1 (gdb::char_vector *buf, } } -/* Read a packet from the remote machine, with error checking, and - store it in *BUF. Resize *BUF if necessary to hold the result. If - FOREVER, wait forever rather than timing out; this is used (in - synchronous mode) to wait for a target that is is executing user - code to stop. */ - -int -remote_target::getpkt (gdb::char_vector *buf, bool forever) -{ - return getpkt_or_notif_sane_1 (buf, forever, NULL); -} - -int -remote_target::getpkt_or_notif_sane (gdb::char_vector *buf, bool forever, - bool *is_notif) -{ - return getpkt_or_notif_sane_1 (buf, forever, is_notif); -} - /* Kill any new fork children of inferior INF that haven't been processed by follow_fork. */ -- 2.40.1