From patchwork Mon Dec 14 15:30:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 343556 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3097141jai; Mon, 14 Dec 2020 07:34:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvnfgN/KKCRHqRbvbtdkoH3FXxnIU/t7OKumd5oT6In762eZjaqunHnr+ur5917EA70Ler X-Received: by 2002:a25:bb8e:: with SMTP id y14mr36778346ybg.380.1607960070695; Mon, 14 Dec 2020 07:34:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607960070; cv=none; d=google.com; s=arc-20160816; b=gHP199zzZnYycpMPsUqVFzQ/YPcDEgHRxVKlRewPikvjps61bouuutqrCJvaZ7UPWo qh5x9EsIGLmsk/7wQ/L3pAKAKStNGfBMrpV+xIrEgT+Cnrj6jEpCpZL10uMzHFT/4zr7 EugVb7ku1aYqUKkdpDCrIfw57Tgo5oHELyJNATWWyEhancEFa9Nd1imx6S83Fgl0muaF +YBrfGC2XCbDrrY8y280rBzDN/3gFJ0mlLU0uQfeyYfqFWuLVSMqbF0Syq6MCqgWSBkd IWlgy2kHApDf6rJP0T9Wp5zTZyA/Kbx0b0LpbHWwzY5YGUjjrBucGay5wXli7cfD9VV2 dpgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=c3huyqy8+fYU69WXa9m/cHIDpA578AI7lcvIx56XNmM=; b=zce9N+ANcIjlohXTidnm0ZdDjx3zRYpcbq/04wHuLcg9lQpputG9cyzD7sDJxO/c7l iqPOsih/dHZ0rHQGeS4eTQRSSx+fnn/rrebWZgKSYWGayvtqmWlf63wYdNK0iQ2Q6zQ1 uRwQ9buwGhIU0DMzFIqt6unfIL/Gr8NeF4/Adom5bUYIhNI8UhdmCnT+/BgHFPIpzI14 NsfhAc4PdkieFHjQB4TC5ZqvqVcPVJn2yq4vn5iFO3pQicOluvuImO6HCF1wstngTilI QbKB4RwMh+mqCzUMzzYD24woEIOhvv72yj3rgFB48pUD4wOvsjqXH9VXD/NWOgvW5O5X 47tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mAkzLs9U; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 18si15341632ybc.109.2020.12.14.07.34.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Dec 2020 07:34:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mAkzLs9U; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koprq-0003ey-5E for patch@linaro.org; Mon, 14 Dec 2020 10:34:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56024) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kopnz-0007pf-LW for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:32 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:51751) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kopnm-000658-Qf for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:31 -0500 Received: by mail-wm1-x343.google.com with SMTP id v14so14110312wml.1 for ; Mon, 14 Dec 2020 07:30:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c3huyqy8+fYU69WXa9m/cHIDpA578AI7lcvIx56XNmM=; b=mAkzLs9UgdBoP7RQNc66cLgZeHIiesJ1CyiaOdGMwCIu4wAnDOtRV9xD9XmZJ+j+Rz 1uOG/ZgnMOMUJd8UDuUeXRdZXs4lhmekKW0QlPKFg8bmJEv9J78QhHcU1xyYPG2UNE7e 5/O2/8bsSOsa4YK0hNafayu9IG6dMIj2tJ0yP9/Ru6bOpTd4sEZ3Ho4GVG3ULhtlAJpc jhwwgOmkueht0AuOe1eHbIq78iz/CjEsukIQ8dE9y8kb2gOcM4Ks2g7RwWIrJxHT7Ak4 OvOquxQkyjVDnbQipjxFPwtGDmrZtN3JMvS1aY89kaO2wr24IracbCEGAqUKuvpXPTXg Mrlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c3huyqy8+fYU69WXa9m/cHIDpA578AI7lcvIx56XNmM=; b=b5ApZ+AGeTrDbfd2GrsDY/caNZZtCZA4z3TF58DJOZNIhEfdMlsJS1YrMdWw1D5bse UwtGoXFzHa+92/CHQvgNWv7sbcQ+w7x0/e6ZJRio7+XIzN4g/cXomRUXNs3RBHAxmfMi j4YJz+GmoSesbdql+DyJQNjqkmkie4BzUHAoxq7fjAaXZzoLde3r4bmTjLtbIiDPgDK8 7QGg0N/9toOB41KK1hRLlv6YBq3HVGv3R/T7fCJoW+hyHkuFzKdxJtziRnkTUTmjaVpq Cgi34bEb5Zk6BdKKJRqqnybKvJ4/xpyWNoORig0gnkqg5KVIN2or3fg1RXv3k3rLk1G0 FcEA== X-Gm-Message-State: AOAM530EzwH+d1i65wF6Bist8bAwq5domSqoBjLtwQ9NGXG/TrP/yjEE JydknHXNyIOPDDD8QwR6NWIuZA== X-Received: by 2002:a1c:b3c3:: with SMTP id c186mr9286236wmf.169.1607959815940; Mon, 14 Dec 2020 07:30:15 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z22sm29482877wml.1.2020.12.14.07.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 07:30:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BFFEE1FF87; Mon, 14 Dec 2020 15:30:12 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 1/6] test/guest-debug: echo QEMU command as well Date: Mon, 14 Dec 2020 15:30:07 +0000 Message-Id: <20201214153012.12723-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201214153012.12723-1-alex.bennee@linaro.org> References: <20201214153012.12723-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x343.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This helps with debugging. Signed-off-by: Alex Bennée --- tests/guest-debug/run-test.py | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 71c5569054..0c4f5c3808 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -53,6 +53,7 @@ if __name__ == '__main__': cmd = "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name, args.binary) + print("QEMU CMD: %s" % (cmd)) inferior = subprocess.Popen(shlex.split(cmd)) # Now launch gdb with our test and collect the result From patchwork Mon Dec 14 15:30:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 343557 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3097252jai; Mon, 14 Dec 2020 07:34:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgmw9GttidySVV336f1g+S7e7Oc73W3sbBxFJrzJZa/dbRNQdU58yLPo89GNBvSXWgtFjA X-Received: by 2002:a25:22d5:: with SMTP id i204mr39857163ybi.0.1607960078507; Mon, 14 Dec 2020 07:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607960078; cv=none; d=google.com; s=arc-20160816; b=VvEAFx6hpXEXG1mZ7cuz/beHxjPzoGmhie47vCL8hjdpewZFyDitoiPloAnwwvK3Vb 6quFKzlcG68DOX9KTbdTrfpm6B5ZsuQGCYibLjevnPoLyO56vVRv5ixR/vW04iwDADOY Uqb7nrS9kr4925PU1PMpYuhSMvqsJBYunWYgpwtdBCCEQj/PhICM4cAB4eeheaCc32X4 iMhI4KcXuDMRyIjWels4P2w0jbwA/3KK8JobgcRa/dEXa75vZ7r+BBFS2qDvYMa2YwvF ZYDRqLDAvK1s7u9ASjduTIpG/dWYKXJg0wKODDZB+PO4OhHMC5KcusQcCBCDRJaCdUCu Whcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=tRKsmU0qEAtPOv4DujHsfCCXKQEIa7oRhg2frJNfMMw=; b=qmZFFf5YWrmfDk3F3uZTBB9Wbq7wsFehTroN+OG/2rcE5bJzK9loMFjBQqXjSTGXu8 /hIL3JN8OjWsz/sy2+XcrBQ0cziTsfykOTwyXhlXJXzgXs+vQkO4t93XORneRLXt9KPq 3Vvdy3e3xt0dx6I9enDHaaT4asabyqwW4ff1kpU1Frcp10sMSDdWZxlFtC2rk55zsyi6 oHy8Ik+YdxvRgSW87Ijq5ljsBZtEUNfOo6H5DV+BWJipvYdtPxGZNmCsBtwpIHQEdrTL +6tC5aHqoZxOUpiPwuOQeagBxZMWV/Fm/P++HjuOa+//UHgIULSIUOmz+l4JaBTzxSdA npDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AgTJa4H2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r15si16436444ybp.407.2020.12.14.07.34.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Dec 2020 07:34:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AgTJa4H2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koprx-0002wR-Uu for patch@linaro.org; Mon, 14 Dec 2020 10:34:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kopnp-0007gs-BL for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:21 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:35008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kopnn-000667-LW for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:21 -0500 Received: by mail-wr1-x42e.google.com with SMTP id r3so16865381wrt.2 for ; Mon, 14 Dec 2020 07:30:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tRKsmU0qEAtPOv4DujHsfCCXKQEIa7oRhg2frJNfMMw=; b=AgTJa4H2j87RYqtKV4o6KTnuDtE01uatIL8Yb/x2iMIpRe7PPcjiGuUst/jXT9juwZ GPZYXtNL2QF1+Mc89t8RgjYlEyMclVWP2JhdrJZ5gr8wFHjHQvLvTF0QI/f/tx2Uods/ UaTw8AVd5sKfrGrDmGgRIUqR+fUrpWlYOWsBnNYVz6FovS6/Fxd7i1rRMSfvkniU50ED mZ76IFXg1nowN/Nc1tV/+iOA7d7XaUxLeaXYPydrUEXsz2mdL0ciKDAw20E4PrAcLm0s kuct9Ib2Av1hItHOkFE/8J5wJUzflDXGjSYXCpGDX7hNlv8vXZQr3C60nQHeWRXlwJhv jnUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tRKsmU0qEAtPOv4DujHsfCCXKQEIa7oRhg2frJNfMMw=; b=Mu5AC3px/qihKUxPGlk1Z3n8oZzXOQr9PAJF6M3/kOb8m1Ugu+/oT7KoVk9LVHMfsk HE3iuayENJOpGjZTUk2HhLco3fBILT3MYj8MvCUnMU1yRxkpADNmJnbY7xQocs627Yfe dpf4rBex/GRcX584UJZG+6G2WzHPpPXr7JN8EUCG+Fbhm3fN7vGmfSCD/iCa/QTPBEk2 6qiQYwrLO51nA8zmC+aYCroeQJrAfDAQzeihhUEOdqGOp/9kYPMl9xHbfcdi2M7FenuM jAjyUAm+pbcu8oOMwDY8jHP5njhyfCtiIjk6K3uSlPM+ezvVonVVEBlrQ8tPBfTVgkLH r5IA== X-Gm-Message-State: AOAM530tyOU7pw8IaoM0EzQLatp8JWFQNvZ5rIczSo9IgY5kEC8JjuSS T1jWHstimcdhPSxdJStRM/NuRE3rxKtEVQ== X-Received: by 2002:adf:fd42:: with SMTP id h2mr15513769wrs.142.1607959817966; Mon, 14 Dec 2020 07:30:17 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id q15sm31706534wrw.75.2020.12.14.07.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 07:30:13 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D45CE1FF8C; Mon, 14 Dec 2020 15:30:12 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 2/6] configure: gate our use of GDB to 8.3.1 or above Date: Mon, 14 Dec 2020 15:30:08 +0000 Message-Id: <20201214153012.12723-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201214153012.12723-1-alex.bennee@linaro.org> References: <20201214153012.12723-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Certain earlier versions of GDB have (possibly distro) derived issues when running against multiarch guests. Also given the problem of clashing ports it is preferable to use socket comms rather than TCP ports for testing. Signed-off-by: Alex Bennée --- configure | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/configure b/configure index 11f5878a59..f6347382e9 100755 --- a/configure +++ b/configure @@ -6721,8 +6721,11 @@ if test "$plugins" = "yes" ; then fi fi -if test -n "$gdb_bin" ; then - echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak +if test -n "$gdb_bin"; then + gdb_version=$($gdb_bin --version | head -n 1) + if version_ge ${gdb_version##* } 8.3.1; then + echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak + fi fi if test "$secret_keyring" = "yes" ; then From patchwork Mon Dec 14 15:30:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 343554 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3094302jai; Mon, 14 Dec 2020 07:31:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4q/V6yzeGfEXoXT9xppxoYxdASwIrYac+/qiZY/SDJrabANbdh9EaoN5SK4b/YTGBz6fQ X-Received: by 2002:a25:aa88:: with SMTP id t8mr20002981ybi.292.1607959866617; Mon, 14 Dec 2020 07:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607959866; cv=none; d=google.com; s=arc-20160816; b=RACHTxTBV71uOHTBIqWOR3KU7ggmj6G1swp6r1zLtAwNy7jLOUrOMZFTbxjA/C4b/c zPblqJeY3dxecEjekiADxgaybJ3SMMo7DiBfvE7JfsIVxcEEgg056Bvyojip0TtzDVgu nrwtzpAvJRRWkteccmXZ5NeYchXe58E43i62h7bZd3nS6LLvUl/ovY0yNtJtAkO7pEyA OzA0Jlvk3Lr+5RJ3tobBjlqkcwR9ANW4VJYlYYOrdokPGiuC9PLqRZNAHCliO1Wp80pL fh+6DBhZBPJO9sTqkmt+ZXSX5lNLMScMfkqSNImJJODJGcPxcTep4JF86BKaA40841AZ 72Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=bXB03b69IRRD0RMhlaFUm5Vdm4BgZtmItrqWS1AnHsY=; b=zAXxtCM2z8FYDRkxUwQ+ONmiIKFSeCV16a9mfz3XpB4lrd4i30ale3y0PX3yghUd0e DqSZysNNslK6Q14ly2CGgc+FoKxc+8jCSRQwiF+bCdkyXvfhHoBInAWazoQepsXUq9aq pe6fuQEwzfXFwNdBj4bQU1sxNzQaefpaGvS9ahRHCI9rTS99Y/sgqZDzb/tKd+MVUDjx ds9zDO0E1uu47RR4CZZwtarUr+sD8Sl24pZ2LSgYeVmWr6SNhxsiTuJETlAF5uNDG2EP euCcuRPdDHG2z3EpI5v/FR91kvrdICiIufCMwAD8qm9fjyRGNJAzIvZ1q8rdzqcWCWNN z7+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dVi7Pbbk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a3si5203427ybj.35.2020.12.14.07.31.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Dec 2020 07:31:06 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dVi7Pbbk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kopoX-0007mf-SN for patch@linaro.org; Mon, 14 Dec 2020 10:31:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kopnr-0007kb-MF for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:23 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:35013) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kopno-00066e-UP for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:23 -0500 Received: by mail-wr1-x433.google.com with SMTP id r3so16865450wrt.2 for ; Mon, 14 Dec 2020 07:30:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bXB03b69IRRD0RMhlaFUm5Vdm4BgZtmItrqWS1AnHsY=; b=dVi7PbbkiKDb1HjXH6UjjVarCGWe4nKSZyGrcWMJe/VTXfJtjQB/V6TrPj2j2hSGnu 4YfhnwOur0SSDNsMgIOlBSP0RKhz1XQm+ZtWN/lmKuSjBu3qJOaTjuIN5FtDqXCvWKtv B0rtlp8kgP3e6C7F0u9sUEqtD1i8umnCEcuViRhaYlEWKojRU/c+mvsIw2dsmvD/b/tC 5Dc1VMIY3yr+/rPpmZVZZnfkSCo+xQUx11IFw/sW9Ale5egYV3sJlYUrQCRvA369DpNw IIt2soRTYU+BqsO4no/dsPDkz9W4fy7BrhH30UeoK9EcmyLVjn5M/Ryv1ZEHSlXKAM9x 1Mgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bXB03b69IRRD0RMhlaFUm5Vdm4BgZtmItrqWS1AnHsY=; b=GYP5lkaRowa9ZzNCqmQ1u6RvQqt4bQDRLbo6nLjOeyQwGtav5tutI4A/ylITMV4IS2 9PLedMdxeclB9NdHN0lbhNOasOwAzHD4ajLQ5J8dnPy0e8EdWZfk7nP2klWrJeFaKvh4 OvSO2hejngnnEAJOhFnarsarazXYHDrrtkJdh8QzFuHTk7gy1kJQabBpwwT2p/CLdyIQ ACrK3aFecaxTHT/oqEtMYJIkCMYrqYM7BCqAK1yPjCue5PhTh1/2Yq81iTx0rOSCsSM3 DAG+tvWMFyNu03M6Gq0VJlNfAV75DF9y7IkMUpkvEySrirLMSzDYximl/haPG6/sFBoe oYwg== X-Gm-Message-State: AOAM531C74OoUNz3W4KJAPzHCs7gfISxzyPHuAzBiOlpB6GyGAmp7BT6 RPyvQD6ZwvpgO7cRf8pRi550lXaZghkQUg== X-Received: by 2002:adf:aa4a:: with SMTP id q10mr28768816wrd.276.1607959819442; Mon, 14 Dec 2020 07:30:19 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id h98sm35454468wrh.69.2020.12.14.07.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 07:30:18 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id EE9141FF8F; Mon, 14 Dec 2020 15:30:12 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 3/6] gdbstub: add support to Xfer:auxv:read: packet Date: Mon, 14 Dec 2020 15:30:09 +0000 Message-Id: <20201214153012.12723-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201214153012.12723-1-alex.bennee@linaro.org> References: <20201214153012.12723-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Lirong Yuan Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Lirong Yuan This allows gdb to access the target’s auxiliary vector, which can be helpful for telling system libraries important details about the hardware, operating system, and process. Signed-off-by: Lirong Yuan [AJB: minor tweaks to test case, update MAINTAINERS] Signed-off-by: Alex Bennée Message-Id: <20200730193932.3654677-1-yuanzi@google.com> --- gdbstub.c | 54 ++++++++++++++++++ MAINTAINERS | 1 + tests/tcg/multiarch/Makefile.target | 9 ++- .../multiarch/gdbstub/test-qxfer-auxv-read.py | 57 +++++++++++++++++++ 4 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/gdbstub.c b/gdbstub.c index f19f98ab1a..ec8daa002b 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -2172,6 +2172,12 @@ static void handle_query_supported(GdbCmdContext *gdb_ctx, void *user_ctx) ";ReverseStep+;ReverseContinue+"); } +#ifdef CONFIG_USER_ONLY + if (gdbserver_state.c_cpu->opaque) { + g_string_append(gdbserver_state.str_buf, ";qXfer:auxv:read+"); + } +#endif + if (gdb_ctx->num_params && strstr(gdb_ctx->params[0].data, "multiprocess+")) { gdbserver_state.multiprocess = true; @@ -2233,6 +2239,46 @@ static void handle_query_xfer_features(GdbCmdContext *gdb_ctx, void *user_ctx) gdbserver_state.str_buf->len, true); } +#ifdef CONFIG_USER_ONLY +static void handle_query_xfer_auxv(GdbCmdContext *gdb_ctx, void *user_ctx) +{ + TaskState *ts; + unsigned long offset, len, saved_auxv, auxv_len; + const char *mem; + + if (gdb_ctx->num_params < 2) { + put_packet("E22"); + return; + } + + offset = gdb_ctx->params[0].val_ul; + len = gdb_ctx->params[1].val_ul; + ts = gdbserver_state.c_cpu->opaque; + saved_auxv = ts->info->saved_auxv; + auxv_len = ts->info->auxv_len; + mem = (const char *)(saved_auxv + offset); + if (offset > auxv_len) { + put_packet("E00"); + return; + } + + if (len > (MAX_PACKET_LENGTH - 5) / 2) { + len = (MAX_PACKET_LENGTH - 5) / 2; + } + + if (len < auxv_len - offset) { + g_string_assign(gdbserver_state.str_buf, "m"); + memtox(gdbserver_state.str_buf, mem, len); + } else { + g_string_assign(gdbserver_state.str_buf, "l"); + memtox(gdbserver_state.str_buf, mem, auxv_len - offset); + } + + put_packet_binary(gdbserver_state.str_buf->str, + gdbserver_state.str_buf->len, true); +} +#endif + static void handle_query_attached(GdbCmdContext *gdb_ctx, void *user_ctx) { put_packet(GDB_ATTACHED); @@ -2338,6 +2384,14 @@ static GdbCmdParseEntry gdb_gen_query_table[] = { .cmd_startswith = 1, .schema = "s:l,l0" }, +#ifdef CONFIG_USER_ONLY + { + .handler = handle_query_xfer_auxv, + .cmd = "Xfer:auxv:read::", + .cmd_startswith = 1, + .schema = "l,l0" + }, +#endif { .handler = handle_query_attached, .cmd = "Attached:", diff --git a/MAINTAINERS b/MAINTAINERS index a83416d54c..9dedc37be4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2295,6 +2295,7 @@ R: Philippe Mathieu-Daudé S: Maintained F: gdbstub* F: gdb-xml/ +F: tests/tcg/multiarch/gdbstub/ Memory API M: Paolo Bonzini diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target index cb49cc9ccb..c8cdb1e04d 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -54,7 +54,14 @@ run-gdbstub-sha1: sha1 --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ "basic gdbstub support") -EXTRA_RUNS += run-gdbstub-sha1 +run-gdbstub-qxfer-auxv-read: sha1 + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \ + "basic gdbstub qXfer:auxv:read support") + +EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read endif diff --git a/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py b/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py new file mode 100644 index 0000000000..d91e8fdf19 --- /dev/null +++ b/tests/tcg/multiarch/gdbstub/test-qxfer-auxv-read.py @@ -0,0 +1,57 @@ +from __future__ import print_function +# +# Test auxiliary vector is loaded via gdbstub +# +# This is launched via tests/guest-debug/run-test.py +# + +import gdb +import sys + +failcount = 0 + +def report(cond, msg): + "Report success/fail of test" + if cond: + print ("PASS: %s" % (msg)) + else: + print ("FAIL: %s" % (msg)) + global failcount + failcount += 1 + +def run_test(): + "Run through the tests one by one" + + auxv = gdb.execute("info auxv", False, True) + report(isinstance(auxv, str), "Fetched auxv from inferior") + report(auxv.find("sha1"), "Found test binary name in auxv") + +# +# This runs as the script it sourced (via -x, via run-test.py) +# +try: + inferior = gdb.selected_inferior() + arch = inferior.architecture() + print("ATTACHED: %s" % arch.name()) +except (gdb.error, AttributeError): + print("SKIPPING (not connected)", file=sys.stderr) + exit(0) + +if gdb.parse_and_eval('$pc') == 0: + print("SKIP: PC not set") + exit(0) + +try: + # These are not very useful in scripts + gdb.execute("set pagination off") + gdb.execute("set confirm off") + + # Run the actual tests + run_test() +except (gdb.error): + print ("GDB Exception: %s" % (sys.exc_info()[0])) + failcount += 1 + pass + +print("All tests complete: %d failures" % failcount) +exit(failcount) From patchwork Mon Dec 14 15:30:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 343558 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3098889jai; Mon, 14 Dec 2020 07:36:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHFdzxERXkOQyuAvtgV8MaDlIpqjGRNkgvXnierbpcccNfTzKVPA9hTXv4FEV/94B+kMES X-Received: by 2002:a25:324f:: with SMTP id y76mr25967221yby.203.1607960193906; Mon, 14 Dec 2020 07:36:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607960193; cv=none; d=google.com; s=arc-20160816; b=Uni3MbjLUeEfyKZmpeJC+6vKj4BbhAFmf0o/Xa8MXTHNqibraYu9Xg+hoOb09wh3Jt A7uklZxCoMExoY2YcXd19Bks8uU08EEtmX9PAHjeOy+brW8LyjCnIFWS1gzMerc3VBtj u5JlDSsIcuEgVpoTeHaIhwGONSR/rfh5BClRTLSLDWq7jZLp2aCZxOjmf85RkhW+1Cjx fJh6kPTwCdTrjiBOlfHnZIwVjXMzPf+T+eZuHtRAGZ8y4tIpV8OmPFesppbbl7CdAvit sgrGS874aQZb95jY/RgBr9FUDkZfZxgyQLnLTG5AMYortpJ8QoY0crU3xUHYgcqIgZFp NkQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=dATvnSiNbzH3IwDni97PXBq4aN519xmIXNmYmOWL0lM=; b=nPgJargqUqgy44xtbd2x0Ye35SG8BoOunbllVGcMqYxac6BojwmzkFGY0JpRfICgpO PooqV/WR7qU/ziIm0/hb9iSfZPkJiDegt53FP/vKpu8Ftozdw5xlwm38/YaiswvEHPHc HZFShIBH+XgBEqLeYD9kr0zyHtIbVrYbG2DsRRP5TU6zrdcqFpxDv0tU/ADCLNGypHCZ kclmjTS5EGe2XpASANjRt4gc8RgemlbclJaaBBe8+Zc41wm8314BDOQ/JZRsOUjdF3E5 ydw9vilvwCyRLtmJfNtNik194Cl/li85GqdOqA6UbxUlgp78Ws4mvEWl+ELpAPKK347+ Wg3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JzYtmShz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z12si18093249ybp.117.2020.12.14.07.36.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Dec 2020 07:36:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=JzYtmShz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koptp-0005nK-BD for patch@linaro.org; Mon, 14 Dec 2020 10:36:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kopnt-0007ml-1d for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:25 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:36972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kopnr-000684-3c for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:24 -0500 Received: by mail-wm1-x344.google.com with SMTP id q75so15640892wme.2 for ; Mon, 14 Dec 2020 07:30:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dATvnSiNbzH3IwDni97PXBq4aN519xmIXNmYmOWL0lM=; b=JzYtmShzwL9A2ZTyH1kSjm5gGQN7L8LcRZt46y1GQnuOZACxjN28FtToulywsIbnXm dvsh/t1tR1VA0squD/FqRbjKpoe2Gf0Zti8WBNmE9zYUeqAOnXjMNKgvLQFZO/d3CvhA hDaofg0/rZqhioWsROOmx+CeeEQl9BXGQkKamjvzlP0Vuvu9v/xQ+lcui1le5yU2E6li rYTB8ffpET0lI7jjSUrMtZriNgoobsyY94y72/ijMDD9xZP2e8kA9gw3oJkL3RjTiIox j4MFwd/Ir0WJmI4/pjTKJxDjvabl3s1j9uEEthr5XvRXxr4E1if1lgPGfVBzCHzWacHz i6Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dATvnSiNbzH3IwDni97PXBq4aN519xmIXNmYmOWL0lM=; b=B+NmgVT+3DlZP1v20lpwFmDpnz/jHV7ELoCHFB+9bWGzzG4oSYUCeTIpNfPBXiAnEG 9KPBWqxpyo0bdIMe7fvQeOLnHSYziHcK/c+NuzcqEsz0naVt4KVEAC3+WIdxqPfFKyp7 TjR/QtH7jer9Z6qqCDM3D2y9Dw06IjkJmo6PFeMPm3twKv9X/uX5OMfWwN8LjIBxpJp3 6MBaN8BB6a514f6fT3VN2zv+frxQiHF87mD6CoGhl5PTVx9ttLIDqp+i/STSWCRLMsG/ ximFtazqyu4bbMxww/by5crDoJdVvwLP/FeMDDoJ+Vb+HQWFZA/JM+deqZZK+stsouim mU1Q== X-Gm-Message-State: AOAM5320eTGYywohfIBAGkmt+Fxb7JFDDdMT5G2tB0y7/InNhST3K2sj +zD0yk+8QFYnDibV/nnqG+rS/mbyDPbMOw== X-Received: by 2002:a1c:2c4:: with SMTP id 187mr28998203wmc.187.1607959821625; Mon, 14 Dec 2020 07:30:21 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id e15sm27711843wrx.86.2020.12.14.07.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 07:30:18 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1B1131FF90; Mon, 14 Dec 2020 15:30:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 4/6] gdbstub: drop CPUEnv from gdb_exit() Date: Mon, 14 Dec 2020 15:30:10 +0000 Message-Id: <20201214153012.12723-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201214153012.12723-1-alex.bennee@linaro.org> References: <20201214153012.12723-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x344.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Chris Wulff , Laurent Vivier , "open list:ARM TCG CPUs" , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" gdb_exit() has never needed anything from env and I doubt we are going to start now. Signed-off-by: Alex Bennée --- include/exec/gdbstub.h | 2 +- bsd-user/syscall.c | 6 +++--- gdbstub.c | 2 +- linux-user/exit.c | 2 +- target/arm/arm-semi.c | 2 +- target/m68k/m68k-semi.c | 2 +- target/nios2/nios2-semi.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 94d8f83e92..492db0f512 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -46,7 +46,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...); void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va); int use_gdb_syscalls(void); void gdb_set_stop_cpu(CPUState *cpu); -void gdb_exit(CPUArchState *, int); +void gdb_exit(int); #ifdef CONFIG_USER_ONLY /** * gdb_handlesig: yield control to gdb diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index d38ec7a162..adc3d21b54 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -333,7 +333,7 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1, #ifdef CONFIG_GPROF _mcleanup(); #endif - gdb_exit(cpu_env, arg1); + gdb_exit(arg1); qemu_plugin_atexit_cb(); /* XXX: should free thread stack and CPU env */ _exit(arg1); @@ -435,7 +435,7 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long arg1, #ifdef CONFIG_GPROF _mcleanup(); #endif - gdb_exit(cpu_env, arg1); + gdb_exit(arg1); qemu_plugin_atexit_cb(); /* XXX: should free thread stack and CPU env */ _exit(arg1); @@ -514,7 +514,7 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, #ifdef CONFIG_GPROF _mcleanup(); #endif - gdb_exit(cpu_env, arg1); + gdb_exit(arg1); qemu_plugin_atexit_cb(); /* XXX: should free thread stack and CPU env */ _exit(arg1); diff --git a/gdbstub.c b/gdbstub.c index ec8daa002b..f6566c7b82 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -3068,7 +3068,7 @@ static void gdb_read_byte(uint8_t ch) } /* Tell the remote gdb that the process has exited. */ -void gdb_exit(CPUArchState *env, int code) +void gdb_exit(int code) { char buf[4]; diff --git a/linux-user/exit.c b/linux-user/exit.c index 1594015444..70b344048c 100644 --- a/linux-user/exit.c +++ b/linux-user/exit.c @@ -34,6 +34,6 @@ void preexit_cleanup(CPUArchState *env, int code) #ifdef CONFIG_GCOV __gcov_dump(); #endif - gdb_exit(env, code); + gdb_exit(code); qemu_plugin_atexit_cb(); } diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c index c892e0e674..5d5654bec0 100644 --- a/target/arm/arm-semi.c +++ b/target/arm/arm-semi.c @@ -1100,7 +1100,7 @@ target_ulong do_arm_semihosting(CPUARMState *env) */ ret = (args == ADP_Stopped_ApplicationExit) ? 0 : 1; } - gdb_exit(env, ret); + gdb_exit(ret); exit(ret); case TARGET_SYS_SYNCCACHE: /* diff --git a/target/m68k/m68k-semi.c b/target/m68k/m68k-semi.c index 8e5fbfc8fa..6230a789b6 100644 --- a/target/m68k/m68k-semi.c +++ b/target/m68k/m68k-semi.c @@ -194,7 +194,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr) args = env->dregs[1]; switch (nr) { case HOSTED_EXIT: - gdb_exit(env, env->dregs[0]); + gdb_exit(env->dregs[0]); exit(env->dregs[0]); case HOSTED_OPEN: GET_ARG(0); diff --git a/target/nios2/nios2-semi.c b/target/nios2/nios2-semi.c index d7a80dd303..e508b2fafc 100644 --- a/target/nios2/nios2-semi.c +++ b/target/nios2/nios2-semi.c @@ -215,7 +215,7 @@ void do_nios2_semihosting(CPUNios2State *env) args = env->regs[R_ARG1]; switch (nr) { case HOSTED_EXIT: - gdb_exit(env, env->regs[R_ARG0]); + gdb_exit(env->regs[R_ARG0]); exit(env->regs[R_ARG0]); case HOSTED_OPEN: GET_ARG(0); From patchwork Mon Dec 14 15:30:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 343555 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3096268jai; Mon, 14 Dec 2020 07:33:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8+UnmnHVmHvevQIouP4cAKnvZADYbGg7Bhc5n9g7Ig+XhiYpflFFYSM6Gv7HMH4J1HBlS X-Received: by 2002:a25:ec5:: with SMTP id 188mr39871329ybo.387.1607960005214; Mon, 14 Dec 2020 07:33:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607960005; cv=none; d=google.com; s=arc-20160816; b=mtItpFkF0iScdfL6eb4qCWkK/RAAH/badQIvdRyzZsqUOLhfagr+2m+7qUewLCX94B 4mfaDsdFJmu1q4m4dRRWTflb7YFQb8tf5l/kkwUr6Q5MaCqcxifWpHDwyg2Iwc59uCn6 0JYTI+sTifojN/K0kaoTVCnnObCA1kpiSZku1tJBbV9bRZ4A51bpobZrGnk5hU3IX6DD VdYB1vno0twBJZ/M1ztQeMgeaE75jjxFedcktUWB/BbhKCBFJripqn4ryzSlQ62QXtkn JtP6rueyG5wqZpYMcQZ3uCZQ2yg0wd9d3xAqTSkC+SEiQ6TgIHNIwyduHBGakCiw05rF kb/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=AyTGjsVZ1hUFkxFr4OcBIz/5XjlUR5r506a9Y66UF4g=; b=bvMOttr52DcHNjLSHYg970ytXl7Jg2kSe4QvyJNlQF7b9HzgulNbKbqJwnC06pZ3RS gXgwj8A5uG5jpMbEgCqZgYxM/HZEOIzCXEH1VGfRbyUmgD/+hJYiV3U7XFca1KnO7HTM 9M2C+kn5wNX8uAe8ITsDqUW2lnrSrEdqtJrojwKo/H4Sxo881W+s5H/yAgJb40/egv7v tYIz+pVQgg1UKt9jbvQOHcvf3PX1Z2uhmpsEHgYRbHP8HeeImRrkrR2py9ZdNZ6Bc6g/ /2Dy/QQ3gF6HOB49AFiYsPaT7tziVgfII2JWJuHI99f9mcIyMjmUY2UUraMpvPjqKQ0T gNZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=qyFFzz0a; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r125si18913411ybr.413.2020.12.14.07.33.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Dec 2020 07:33:25 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=qyFFzz0a; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kopqm-00026W-NI for patch@linaro.org; Mon, 14 Dec 2020 10:33:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kopnu-0007nh-Fp for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:29 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:37083) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kopnr-00068K-US for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:26 -0500 Received: by mail-wr1-x443.google.com with SMTP id i9so16845314wrc.4 for ; Mon, 14 Dec 2020 07:30:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AyTGjsVZ1hUFkxFr4OcBIz/5XjlUR5r506a9Y66UF4g=; b=qyFFzz0a2jZAVVfg+/cRN9uXPbnwXylhX4jyu7Xct4OEJj01h4Dn5HT8mzmZT4x2T/ 24OFOR/ZzTVmpjZeyXb4Qnl/aTyS9jLRP4/MM1oahnMmTO3+9/l1bKho/mp36fAT8Gx7 W8gZtIAr+0uu1rzH3zhw0G8iCYid7poMQaNE0pqn3eMiMYAxjQj/UK474UKyFXO3fW3L wnkPudjXV3ZMOKSw273e17xB1VJE020m24s6t0nNmeNv1bi+phW6OQ/s8AqK3ea1rljA 6YAv75Lfpvn2dLmklC5DwNzmydBD2vpMrN6KN/nPLB+oMUOcWr2SEnQ4NizxJbD7epef N2UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AyTGjsVZ1hUFkxFr4OcBIz/5XjlUR5r506a9Y66UF4g=; b=M5fMjByRQUyMex7EajteE2zxh9a9FYIvyZx698BeaAFu/r45f5DI8HvJ+cde9CTTfk VyrXD0QROZ/9xZeOf3tHq5SFc5zh6V76t1qEFOmygM4bbJSeoGVaAsZpsA09QR5OiGXn 59oUcNwg7qtKX1FEQ/ZJ5RlgLiXC692kPgN23OkipKKrvlMMocHBZHE7kp5Eri14EmD7 qGck1ppEP+GZSlApkXvb8tEJrDPYddqlreOZFaPXgAll5nRD0sYWhkGxRWXIquMLlcZG 3zauzf4dAzs0uxhv1cdIWGBmpLW//9iK0eOZGMxjX5Apu4zPeOcd6QENbp4weF10sAkN B/1A== X-Gm-Message-State: AOAM5309OajbRy+NIQqJWr1qui8dQRSpRcLuxRG/FCLAE+7u1OvNW4Xu aGmUL/R2eb3pOOB0GTJSMt9voA== X-Received: by 2002:adf:df03:: with SMTP id y3mr22786495wrl.102.1607959822548; Mon, 14 Dec 2020 07:30:22 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u66sm32040538wmg.30.2020.12.14.07.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 07:30:18 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 340FE1FF91; Mon, 14 Dec 2020 15:30:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 5/6] gdbstub: drop gdbserver_cleanup in favour of gdb_exit Date: Mon, 14 Dec 2020 15:30:11 +0000 Message-Id: <20201214153012.12723-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201214153012.12723-1-alex.bennee@linaro.org> References: <20201214153012.12723-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x443.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Paolo Bonzini Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Despite it's name it didn't actually clean-up so let us document gdb_exit() better and use that. Signed-off-by: Alex Bennée --- include/exec/gdbstub.h | 14 +++++++++++--- gdbstub.c | 7 ------- softmmu/vl.c | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 492db0f512..ff0b7bc45e 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -46,7 +46,17 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...); void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va); int use_gdb_syscalls(void); void gdb_set_stop_cpu(CPUState *cpu); -void gdb_exit(int); + +/** + * gdb_exit: exit gdb session, reporting inferior status + * @code: exit code reported + * + * This closes the session and sends a final packet to GDB reporting + * the exit status of the program. It also cleans up any connections + * detritus before returning. + */ +void gdb_exit(int code); + #ifdef CONFIG_USER_ONLY /** * gdb_handlesig: yield control to gdb @@ -187,8 +197,6 @@ static inline uint8_t * gdb_get_reg_ptr(GByteArray *buf, int len) */ int gdbserver_start(const char *port_or_device); -void gdbserver_cleanup(void); - /** * gdb_has_xml: * This is an ugly hack to cope with both new and old gdb. diff --git a/gdbstub.c b/gdbstub.c index f6566c7b82..7172f063a1 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -3547,13 +3547,6 @@ int gdbserver_start(const char *device) return 0; } -void gdbserver_cleanup(void) -{ - if (gdbserver_state.init) { - put_packet("W00"); - } -} - static void register_types(void) { type_register_static(&char_gdb_type_info); diff --git a/softmmu/vl.c b/softmmu/vl.c index e6e0ad5a92..0694a1d602 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4509,7 +4509,7 @@ void qemu_init(int argc, char **argv, char **envp) void qemu_cleanup(void) { - gdbserver_cleanup(); + gdb_exit(0); /* * cleaning up the migration object cancels any existing migration From patchwork Mon Dec 14 15:30:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 343559 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp3098921jai; Mon, 14 Dec 2020 07:36:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhkv3e8/mWJcpIM6moV59NBya1zC6jG3kbmXyRfx5Cmz20YafC3XVvDO6Dpv24v4jf5IEo X-Received: by 2002:a25:d452:: with SMTP id m79mr23089952ybf.417.1607960195345; Mon, 14 Dec 2020 07:36:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607960195; cv=none; d=google.com; s=arc-20160816; b=LmXl1LWQU5HcQkAFMnCXOIW3fAMrYkliO3KWTHcnvkay6i7vSy9CFVf1+P9qyNelzT FkILpSKo3Ms2wSSnGtmbZs6Q5SPQCXt/ZKwKxkmD3xOur0H0TzEBFY2I7HpwTumG5VwL Hupw0aEcl39FlyqcCHowUFZzzbXaJNCOGOd/2vsRxsyGFgX89sT9XnAykkez1n4E3WY1 mnBR+20mND8PFdWoNARtGyzS4iTf86qYhgIsc1k4GPEpFhehOeSYQWJC4MYpiSdxvAyA gedkF6M1+X2i5OnKNhQ9rTbLkC9jsFc2A7SKB3cOo4XFOHfubD29yKFaD+tloJ1lZJd/ lG0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mswVJ8W6L1K/A6VuFf51dF/y+gVp/RoCPsfkvo9QLzE=; b=zRNWOh9W072zUi6Z3iRttO7QIg2PHE6GqFRyx6Brk8/Ac5XcqL3lIQGFrf6Irob1VC czH0tTgdgWU6z14RZcSbv802r7TJkejYtAAhNq7y1j8Nh7IsQqq994tlCSyoUoW37nGz 1uO6FRz0/CbYhhO8TT69tkKrfrmwZ2VOTfOb84UYzIJATAIqk2cGQ4dXsPhDJz9xU1h0 0pdXTXs6B75PX2Z3wna/PbtefBngiTsDPCjdXaB2HG1IwbvYNWFaumLcDem6AjAdn8an VMePSZWapAStltPk3sS06UWf2sr8tDN3+p9jAsk1MY+hmzKaCPRGDbcWC/XbbxNky0PU cV3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="QVkwCJ/j"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f94si18899376ybi.385.2020.12.14.07.36.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Dec 2020 07:36:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="QVkwCJ/j"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koptq-0004xL-S6 for patch@linaro.org; Mon, 14 Dec 2020 10:36:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kopny-0007o2-Iu for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:30 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:52520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kopnu-00068a-2I for qemu-devel@nongnu.org; Mon, 14 Dec 2020 10:30:30 -0500 Received: by mail-wm1-x343.google.com with SMTP id a6so14110861wmc.2 for ; Mon, 14 Dec 2020 07:30:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mswVJ8W6L1K/A6VuFf51dF/y+gVp/RoCPsfkvo9QLzE=; b=QVkwCJ/j3zPIV4YA1tBPzveprpEbQjG+cxzTzsAUbIdpiDQPZfCdu27TyzapPAHyK6 x8VglSx26Z+Qh1nF8zqljmNUOYv5gSGDgIbjQ56qOZIRCvS3oSHHFj/a5naNNeoDaw3T nXVj7Q2xp4wtpts9rqBOxK+zvS0GyCDq0nNewRodU+1k2fPx0K4Yk/L1RchsyzF8kBxD aqtJFG+UdvWUvJRU7wKpyICezroRgzPUN5ie56b+84xxOc4+R9tByTx7+EtZcO+sF+2c Rig2ZmvKtHji14K2+x25p5e0+bo0rkjtWC+kfiGm5/7AXWqqsusEMoLPtFZDLbAcKvmg gk1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mswVJ8W6L1K/A6VuFf51dF/y+gVp/RoCPsfkvo9QLzE=; b=MmPUBWrr+T+m+9/aFuJr/7aWl9Hv/Wh+D+GiPAIZ79yYz42J20Lq14OQGdD5sNbA79 O7lSNTGhWukevbgQHEiXBVtMsPcHVXHvflZjc2n9iwU9+fwKj/KAcnK53N1cMvGeDpa8 3JhN3lz8hakrqHHUoV02eKopvC/Es1AemL3qdQeme9qU3UeYbqi5qD5kn+wj8O6pxop6 XX+skAyF74WLNUtNGwlU0Hby6sQerDNC7hIaihcpB87fQAToBAaTRkTupfIwpoBnNovB rDMEgSiI9oJKVZ7KwcrWUJc7xeEAh1iB0/jIcBUCCrqMJYEefKA9Mp7YCAsDsoDjSUHX zIUw== X-Gm-Message-State: AOAM530sNQsMvyToiZj6+qM1X09nC/XQo6Aevn3M+ryzN88ok3u8NUTr sdrtQ0O7A0jF1BIwhaAKzYDXfg== X-Received: by 2002:a1c:a785:: with SMTP id q127mr23794528wme.25.1607959824657; Mon, 14 Dec 2020 07:30:24 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a144sm31463691wmd.47.2020.12.14.07.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 07:30:18 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 494341FF92; Mon, 14 Dec 2020 15:30:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 6/6] gdbstub: ensure we clean-up when terminated Date: Mon, 14 Dec 2020 15:30:12 +0000 Message-Id: <20201214153012.12723-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201214153012.12723-1-alex.bennee@linaro.org> References: <20201214153012.12723-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x343.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" If you kill the inferior from GDB we end up leaving our socket lying around. Fix this by calling gdb_exit() first. Signed-off-by: Alex Bennée --- gdbstub.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/gdbstub.c b/gdbstub.c index 7172f063a1..61fe2360e3 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1978,6 +1978,7 @@ static void handle_v_kill(GdbCmdContext *gdb_ctx, void *user_ctx) /* Kill the target */ put_packet("OK"); error_report("QEMU: Terminated via GDBstub"); + gdb_exit(0); exit(0); } @@ -2539,6 +2540,7 @@ static int gdb_handle_packet(const char *line_buf) case 'k': /* Kill the target */ error_report("QEMU: Terminated via GDBstub"); + gdb_exit(0); exit(0); case 'D': {