From nobody Mon Feb 9 04:12:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588273389; cv=none; d=zohomail.com; s=zohoarc; b=F8H1UpnbqUc8ngqa9KivfJiiVtKeSd16HKI572JTSxUrlLFx8zbFT5oNyaTeiZNYJfpCalc/+fw4nbIndH4mQcBBeU09LJOLKaTXIHLwMjkCQ08Qv3SDMSx5wUbCsD+R9yavk/O/UNWKyBvHNl6GnXQWMsOY7dafEps8XmYqObk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588273389; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yWh3aRGKef9xVplQd968UKYGmgCSPBAT3qOdlODDYkY=; b=ceYo/Ei3x4+4H2+kPYL3EtOhRTH7D9GHHJ+YtVt4F8mAEzNQg8h+nbY4BrOUd8BgA8YAcM9XzK3dHHqr75KEpMObit4nSp1OITKXB1E79ZP+xsB520Vt/X1RORDFOvRvWBgzOgYJuNW1Cx2POU81jvcyhYR85LEQ0PkXPgMaEGE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15882733892271013.1974027969059; Thu, 30 Apr 2020 12:03:09 -0700 (PDT) Received: from localhost ([::1]:50880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUESh-0007sf-59 for importer@patchew.org; Thu, 30 Apr 2020 15:03:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43248) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUER5-00068h-CX for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUER4-00036s-Oe for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:27 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:37828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUER4-00031l-9J for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:26 -0400 Received: by mail-wr1-x443.google.com with SMTP id k1so8428943wrx.4 for ; Thu, 30 Apr 2020 12:01:25 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l5sm692079wmi.22.2020.04.30.12.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:01:23 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id AE90C1FF87; Thu, 30 Apr 2020 20:01:22 +0100 (BST) 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=yWh3aRGKef9xVplQd968UKYGmgCSPBAT3qOdlODDYkY=; b=NiS7HOZBmh9WbMbvRyw01RMvsslcTHr62j4nGPGx04j78hhA75P9Q69GqvBszN2WFj 4SOWyLl+F9Z7qNRqZEuKjWmrJ4PLfDLTzyiWY4GpyLSEmZAl8Rr4Z9A6VtLuD0jCotQU H5p4lbO5QazuwEtTu/hAYCvkH1QTy0tF3khJ4681Es/4fu6OB+1BmlFaweDbfYJAexKm jUGImJW7KhWfid6Bk2exNpnzlrRgt8a7Ez7aq7bjlkp0paiqKe7rbbqkq26tBJPDs2jr /XrasTxQyXZDR+qF8++WdOh1rE/4OUXYM2xNPD6HNp8d/Zr1dSwauVSe6ofqJNgTGX4u NRFg== 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=yWh3aRGKef9xVplQd968UKYGmgCSPBAT3qOdlODDYkY=; b=hvcWIQwBSBTqNEGbcZXZ52ZOeQTkR1mLq7m8Bpek0Bx+J7cIU/VNQt+HcgMxzjYl4I P148/1phtFUlO760d1CKwMcBzDV7xRc87dQCG6yIURxuYuyTEy9TaxTegirrpXv9scD2 D9uHJQYzADy7gjuEKGAAfisv3uTW5RIi9kcGk0/0TKLHh9o6miZ6l+sgar9O+DQdaYQY DfQYyEOuZxgW/+HI8P2FEyY5KdQ9O77hNQcolB/naBHUyFqKICkk6aLjdKCdJqCNrT2s C5Q1xi/2MnW6G88lNAKYzY1sNzJyLbylEFLz89gSFKJVQ4f3dD7pZKX7fAPjcFclxeKr keuw== X-Gm-Message-State: AGi0Pua6s2IhFEprBdSUr2+X3E6GSlsiGv0mZckAsSeEejqkpuoKmgE0 +lcx7xW2v8Q6INVxswMjh1QM/FWTnZ0= X-Google-Smtp-Source: APiQypIcbeARnCquFav+BAc18+7h/U4GJirQo2w27x9dbWamveneFoAalV3qSeGOpZOhJPFKzF7RXA== X-Received: by 2002:adf:82c1:: with SMTP id 59mr3588975wrc.377.1588273284623; Thu, 30 Apr 2020 12:01:24 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 1/9] configure: favour gdb-multiarch if we have it Date: Thu, 30 Apr 2020 20:01:14 +0100 Message-Id: <20200430190122.4592-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430190122.4592-1-alex.bennee@linaro.org> References: <20200430190122.4592-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::443 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=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) As gdb will generally be talking to "foreign" guests lets use that if we can. Otherwise the chances of gdb barfing are considerably higher. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 23b5e93752..c58787100f 100755 --- a/configure +++ b/configure @@ -303,7 +303,7 @@ libs_qga=3D"" debug_info=3D"yes" stack_protector=3D"" use_containers=3D"yes" -gdb_bin=3D$(command -v "gdb") +gdb_bin=3D$(command -v "gdb-multiarch" || command -v "gdb") =20 if test -e "$source_path/.git" then --=20 2.20.1 From nobody Mon Feb 9 04:12:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588273560; cv=none; d=zohomail.com; s=zohoarc; b=C/022ASJRLJ+DBa7Q746lLXN/0iBnGy4dnlk8o7D85x3B92ftbYX8Lgwl2XZwxUxcTvlcnkwgb6xQ40GRxmyk8wSzyCcwPnxupmOTDxun6UbOPvmEboUv8j7UUa0WfRt6+oQA8Cl00T0jLSb6q/tcbBnVWslIKkYNOCi4aoMZac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588273560; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zg2dR+/RlCjvNQhC4AT2xzR1UuuQk7HaGZ9Y5groXFk=; b=iksYy6+JBscSCmddcPTS9gpuExRlaUqW8efCidtVerS+6VipkfaImV8vhWGMxN2tXQzb2qcYKDZQ3yUvdSt1A2x2NJB68GiknZZxqh5L49iiIcajI30Tp0fbloqnsaZv4OcjpgLcX8iRwnyrEvSxntZklQsqoQW5DdgK7nOh7GY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588273560781305.20114957316537; Thu, 30 Apr 2020 12:06:00 -0700 (PDT) Received: from localhost ([::1]:59464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUEVT-0003Z6-Ai for importer@patchew.org; Thu, 30 Apr 2020 15:05:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43258) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUER6-00069Z-G7 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUER5-000379-Or for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:28 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:52648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUER5-00036e-9Q for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:27 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 188so3168448wmc.2 for ; Thu, 30 Apr 2020 12:01:26 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id j10sm726717wmi.18.2020.04.30.12.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:01:23 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C7F651FF8C; Thu, 30 Apr 2020 20:01:22 +0100 (BST) 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=zg2dR+/RlCjvNQhC4AT2xzR1UuuQk7HaGZ9Y5groXFk=; b=gBtI8HinO3UqJ/dSO5jWz3OMGDv0oD8tmabQyMkWv2cOrn7DSkIq5IqNG79Qp6SPXZ Er0iVjEsYdW7+CfeePlRfAAAG7arBHj74M2aXaYmWpKoy5bgjoXxJeCGixi8HJWxc7qq OKB2Qo0fZpIszABJ6y/bcLFh8uDs3QeNgd4Fvx8NUr2vuacgPwhO+WXjehc/G5z0tG2W WMx50wM3TPFR8erVFep/Sy++6J4JFSsDYkLuxu7ZDH3YR2HtiNeKxjvpyDwgNkyqPdd5 LtYmcxuwMLzlMM4OvKUbnEnKGypW7UA6RAHNvJp67f9u0m3ohQcpyreq2gI4APKMjUJv 5CBQ== 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=zg2dR+/RlCjvNQhC4AT2xzR1UuuQk7HaGZ9Y5groXFk=; b=mfWztBfnVyXzwwoUXhztxV59lGFwHLEIfEyPwifrqNCVpi2zZBpwhuN3PWOmACl2mE y7cN+Lv9yNGdfnv5bIYyKrPcM0R0lN/6ihGfUXxAZc4L9oD9bV4/UJWI+45UqMc9hm1M of/o+mUwesXtFqnDludspnA84Na+ZTnm0sYm/ItaqYuLSwHtqxXXZSJCOEWEFXOlfrDX HpbWcW8yhs7gCf/o0snvfljeIj4gPVVOaj5whIlK/GOx2B8mbEtUOG5SCsqpIs5JzR1l Xf+AkvBMwZSzwI2JwiAb9xlXkHz+oNQgqjTkbf9qh6KDB1Ir525Jvh36Qftu5ALKCp3Y OYgQ== X-Gm-Message-State: AGi0PuaGbIqchLX6QkT1J102SPhEL0mM9rtZnjpVYf96DagwHBILTIGx bmrApTLJh3mNeWoP2ZxzucczqA== X-Google-Smtp-Source: APiQypJGP2smoJ1XNH2qXXvf3TytFrRO3GjxLkAh00u16EUQKskDyZ6XaQk3oS1AyGst57nAIjOQHA== X-Received: by 2002:a7b:cc8e:: with SMTP id p14mr47955wma.70.1588273285747; Thu, 30 Apr 2020 12:01:25 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 2/9] gdbstub: Introduce gdb_get_float64() to get 64-bit float registers Date: Thu, 30 Apr 2020 20:01:15 +0100 Message-Id: <20200430190122.4592-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430190122.4592-1-alex.bennee@linaro.org> References: <20200430190122.4592-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::32e 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: "open list:PowerPC TCG CPUs" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 When converted to use GByteArray in commits 462474d760c and a010bdbe719, the call to stfq_p() was removed. This call serialize a float. Since we now use a GByteArray, we can not use stfq_p() directly. Introduce the gdb_get_float64() helper to load a float64 register. Fixes: 462474d760c ("target/m68k: use gdb_get_reg helpers") Fixes: a010bdbe719 ("extend GByteArray to read register helpers") Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Alex Benn=C3=A9e Message-Id: <20200414163853.12164-3-philmd@redhat.com> --- include/exec/gdbstub.h | 11 +++++++++++ target/m68k/helper.c | 3 ++- target/ppc/gdbstub.c | 4 ++-- target/ppc/translate_init.inc.c | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 20e1072692..4a2b8e3089 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -134,6 +134,17 @@ static inline int gdb_get_float32(GByteArray *array, f= loat32 val) =20 return sizeof(buf); } + +static inline int gdb_get_float64(GByteArray *array, float64 val) +{ + uint8_t buf[sizeof(CPU_DoubleU)]; + + stfq_p(buf, val); + g_byte_array_append(array, buf, sizeof(buf)); + + return sizeof(buf); +} + static inline int gdb_get_zeroes(GByteArray *array, size_t len) { guint oldlen =3D array->len; diff --git a/target/m68k/helper.c b/target/m68k/helper.c index cad4083895..79b0b10ea9 100644 --- a/target/m68k/helper.c +++ b/target/m68k/helper.c @@ -72,7 +72,8 @@ static int cf_fpu_gdb_get_reg(CPUM68KState *env, GByteArr= ay *mem_buf, int n) { if (n < 8) { float_status s; - return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d,= &s)); + return gdb_get_float64(mem_buf, + floatx80_to_float64(env->fregs[n].d, &s)); } switch (n) { case 8: /* fpcontrol */ diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index eb362dd9ae..5c11c88b2a 100644 --- a/target/ppc/gdbstub.c +++ b/target/ppc/gdbstub.c @@ -130,7 +130,7 @@ int ppc_cpu_gdb_read_register(CPUState *cs, GByteArray = *buf, int n) gdb_get_regl(buf, env->gpr[n]); } else if (n < 64) { /* fprs */ - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32)); + gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32)); } else { switch (n) { case 64: @@ -184,7 +184,7 @@ int ppc_cpu_gdb_read_register_apple(CPUState *cs, GByte= Array *buf, int n) gdb_get_reg64(buf, env->gpr[n]); } else if (n < 64) { /* fprs */ - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n - 32)); + gdb_get_float64(buf, *cpu_fpr_ptr(env, n - 32)); } else if (n < 96) { /* Altivec */ gdb_get_reg64(buf, n - 64); diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.in= c.c index e853164a86..d825cb5975 100644 --- a/target/ppc/translate_init.inc.c +++ b/target/ppc/translate_init.inc.c @@ -9881,7 +9881,7 @@ static int gdb_get_float_reg(CPUPPCState *env, GByteA= rray *buf, int n) { uint8_t *mem_buf; if (n < 32) { - gdb_get_reg64(buf, *cpu_fpr_ptr(env, n)); + gdb_get_float64(buf, *cpu_fpr_ptr(env, n)); mem_buf =3D gdb_get_reg_ptr(buf, 8); ppc_maybe_bswap_register(env, mem_buf, 8); return 8; --=20 2.20.1 From nobody Mon Feb 9 04:12:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588273404; cv=none; d=zohomail.com; s=zohoarc; b=HrdGuLFYFxhnfj9GCQH3pQiBhrq5rFuwPCkDfaFLScwe+0XM7Wi8YJ1ElvF3RIXdzrCstjLnHP1n9Lsepcs26HB2SbysK3ZhBkgXlvBPYcElzZmSQ2dJKgTk4UoEdvrlEd1+FlgG78UKEVdKAOv2K0uvwe4+rMVoDuPh2aZUdYE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588273404; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0Xn/wGLfgFLD46kRhQwU2daT/QhgqlaCuFRqlRFnVf8=; b=LlxyAEl28yIDz9PyQ7fh0T8jhYfBtAf3rgWDAjS+ybBbwMom9+FwS5MNlx6Y+Nx0W5pbhWIKVMgYQbcn1Z2s7FcPlmxwwo3Hsys48gkcU3LHHvClmAGvPmV7VXkAKE5r0iNTOyh9xJGeN9i1ejoWCRuQSZwz5lLeZ57/YnDkaXk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588273404952946.0740771070072; Thu, 30 Apr 2020 12:03:24 -0700 (PDT) Received: from localhost ([::1]:51914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUESx-0008LC-CI for importer@patchew.org; Thu, 30 Apr 2020 15:03:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43304) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUERC-0006Da-B4 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUERA-00039d-EW for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:34 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:36592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUER9-00037z-0E for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:31 -0400 Received: by mail-wm1-x32a.google.com with SMTP id u127so3322756wmg.1 for ; Thu, 30 Apr 2020 12:01:30 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id h16sm1004908wrw.36.2020.04.30.12.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:01:25 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id E041A1FF8F; Thu, 30 Apr 2020 20:01:22 +0100 (BST) 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=0Xn/wGLfgFLD46kRhQwU2daT/QhgqlaCuFRqlRFnVf8=; b=LS0rnv1DgH7lE1OGbrZUs96l+sCf7xlVLImpMB/kz2EnK2fCT2PVPOacXb83K4H1T8 rf82v3q3qhlK/62AzsrC0XeoOCFOjsGkSCVQffMCcKLxGZn1bGHbmRWZbxgNXJA11Ft4 utsewYb2qTlrIszCKO7vL/9oNgnJCmmg7d3SBA2sfrCpvx8sqJmgGX7x0QGIs83N2n8S Db6AfKCUKFX4c3PxgX3MuYbQxkkaEYgHyg/gnI/WHZ5iJwV+DkBWgcNy/XpvLvl1Ifvb S35OXXp/+2LI9Q2vCjRZMdzpvFTsvwz6iNH6QEL10DzD4BGBR/WtvKDv6VQbdQ/GNXY/ EbLA== 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=0Xn/wGLfgFLD46kRhQwU2daT/QhgqlaCuFRqlRFnVf8=; b=TfuComi+WaTv2TvKJQuTPe/FYII4hvtD+iDqT69B1cxfNSMqFtVJO4v1LNkIkZY2Lo 4aD2WkS14BzYFDbQv4F6+XlsiJ8X8WL0V8M0bA9aubD8Br91LX4ZO2tDngW5SI6JmMBN lOza/meu6xmXQnqQcsJusQhBzMSLbAwS7TgWQaxDWLeTAfc6OI2DjYOkp4Bd6H76IvM7 0ichJ1wxfNGORCDnG8rl3YibJUnoliN898GPlyId8ijVJdVv0U3r+wOxcQPkMGRGWFmT 5IZ+zwep7EAv5C7qfEpQSMQcvEgu1ppusNESpnoCgApmergv3aoPNpwnsnkQ7oi0nQhk aqmg== X-Gm-Message-State: AGi0Pua8hhWfOzbEa31QqO6NrDYa1Rn0PJ9Qj2G1EUDcvJehh8biSMbG 4ELO/0KQtkPAIFOvNaLBN8lSBs7mr7Q= X-Google-Smtp-Source: APiQypIeaIKCLDyUj2UNYVeBD+r/ShR6t0OSXxYoX/nUy5Cng29Wfw4zTAzsatshFWTN9mcuTZFTMQ== X-Received: by 2002:a7b:c755:: with SMTP id w21mr39304wmk.120.1588273289489; Thu, 30 Apr 2020 12:01:29 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 3/9] tests/tcg: better trap gdb failures Date: Thu, 30 Apr 2020 20:01:16 +0100 Message-Id: <20200430190122.4592-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430190122.4592-1-alex.bennee@linaro.org> References: <20200430190122.4592-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::32a 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: Peter Maydell , "open list:ARM TCG CPUs" , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) It seems older and non-multiarach aware GDBs might not fail gracefully when faced with something they don't know. For example when faced with a target XML for s390x the Ubuntu 18.04 gdb will generate an internal fault and prompt for a core dump. Work around this by invoking GDB in a more batch orientated way and then trying to filter out between test failures and gdb failures. Signed-off-by: Alex Benn=C3=A9e --- tests/guest-debug/run-test.py | 19 ++++++++++++++++++- tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 1 - tests/tcg/aarch64/gdbstub/test-sve.py | 1 - 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 8c49ee2f22..2bbb8fbaa3 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -50,8 +50,25 @@ if __name__ =3D=3D '__main__': inferior =3D subprocess.Popen(shlex.split(cmd)) =20 # Now launch gdb with our test and collect the result - gdb_cmd =3D "%s %s -ex 'target remote localhost:1234' -x %s" % (args.g= db, args.binary, args.test) + gdb_cmd =3D "%s %s" % (args.gdb, args.binary) + # run quietly and ignore .gdbinit + gdb_cmd +=3D " -q -n -batch" + # disable prompts in case of crash + gdb_cmd +=3D " -ex 'set confirm off'" + # connect to remote + gdb_cmd +=3D " -ex 'target remote localhost:1234'" + # finally the test script itself + gdb_cmd +=3D " -x %s" % (args.test) + + print("GDB CMD: %s" % (gdb_cmd)) =20 result =3D subprocess.call(gdb_cmd, shell=3DTrue); =20 + # A negative result is the result of an internal gdb failure like + # a crash. We force a return of 0 so we don't fail the test on + # account of broken external tools. + if result < 0: + print("GDB crashed? SKIPPING") + exit(0) + exit(result) diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py b/tests/tcg/aarch6= 4/gdbstub/test-sve-ioctl.py index 984fbeb277..387b2fc20a 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py +++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py @@ -70,7 +70,6 @@ except (gdb.error, AttributeError): try: # These are not very useful in scripts gdb.execute("set pagination off") - gdb.execute("set confirm off") =20 # Run the actual tests run_test() diff --git a/tests/tcg/aarch64/gdbstub/test-sve.py b/tests/tcg/aarch64/gdbs= tub/test-sve.py index dbe7f2aa93..5995689625 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve.py +++ b/tests/tcg/aarch64/gdbstub/test-sve.py @@ -71,7 +71,6 @@ except (gdb.error, AttributeError): try: # These are not very useful in scripts gdb.execute("set pagination off") - gdb.execute("set confirm off") =20 # Run the actual tests run_test() --=20 2.20.1 From nobody Mon Feb 9 04:12:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588273571; cv=none; d=zohomail.com; s=zohoarc; b=jXZC4qlfZVvk5zvx5yZdm0qGb7xTI06+HG6VPIhGBL3AON9+bESpYbqBg9km5K4OUTHYegzNqPUEgkAQ6vSJxJWZ45//WBTMoH9JqGfRTaiZKUgjGKG+6fvVLQYW2JzXpc98Wiv4McnGhPDjfXygJDnEbJYXANDL6ND4EB/407o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588273571; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CdlDA7BMPwodMgRCX0xuQP7nMRxxWJAZKYksxv5dmZ0=; b=OjbqNTEOKJVv7A6SI3ILksVj1QyEXrDb9fFVdugT3iEuYHWi537M7L3XQ46YupIKapyqxvw2kQsVzG3TkC+aLXipNB8WAZoGhwp4hTvqOe6IkQG4vuFYgEm6ToFrysIC6nl3MnLWG0AJmSar8qzMRGTuQ6ZQKmu+SG/qrl1YbK0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15882735715031017.0230176353647; Thu, 30 Apr 2020 12:06:11 -0700 (PDT) Received: from localhost ([::1]:60410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUEVe-0003wi-5p for importer@patchew.org; Thu, 30 Apr 2020 15:06:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43318) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUERD-0006Ew-EV for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUERB-0003A7-4P for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:35 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:55646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUERA-00038k-GG for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:32 -0400 Received: by mail-wm1-x330.google.com with SMTP id e26so3173719wmk.5 for ; Thu, 30 Apr 2020 12:01:32 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r20sm687752wmh.26.2020.04.30.12.01.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:01:27 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 01A9B1FF90; Thu, 30 Apr 2020 20:01:23 +0100 (BST) 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=CdlDA7BMPwodMgRCX0xuQP7nMRxxWJAZKYksxv5dmZ0=; b=c0ZD8xZPVJXIbdPhdjP7tGfgN/G0Njx+lxCbCWAUwkaYitwRBEuIfC2Vu+7acYZgrK E+m7HHEDENt7iHTIr+eP/T8J+f5VBM0l1du8gxfmUK1ETA+nflmXpF8nK4LsmuNHnrLY JHkmMEmN75fGsAnzfi0ReXZLs4jCaRss1qYWvOOkyHgdDqavZe5bI+qtbBSFrsBFM37f gClgH2BHME4cqJkyVW/Q9738JEeX3CZ3PxVwym2xHoXx5uOXzai9yE3CVLUooJqtBuGx en96fLiu3JcSk5qpquojxGkCz3+iPF+vrz279DV76yKMAykLM3e/S4LiQesDe7fCGdFF 7jgA== 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=CdlDA7BMPwodMgRCX0xuQP7nMRxxWJAZKYksxv5dmZ0=; b=eR0f9cyHR0qQq9JQyFVY5OFIUWbBwzVp8+mK5C8NrNKNEA44hDMHr7TJxPEgpaBeWl sVDQtj2Mxj0LUIcDLP8PvlSmBq4knItGEgmkKZkjOOaSDZPS7aG+00f5u+NrK+kdLceG miK9V2K9JFrZud1xpytIJbgtolYXfj34/pf9i1E7BAneX0nwlXFdVdYxse8TgJUH6GSA 6ydc4Pu2Mhtg1fX80n7YhewUMnjrNnXi1v+Lfji5zJkwcWN/aZY8UCL7dYo9Lf6D88U9 PhPks0diu5H3o1aZnKUdAa+8WKZzV1vHhkPf74s+sLUkJYIPF/mfgRHQ378JKj8F4dak 228w== X-Gm-Message-State: AGi0PubMDf9XGGfo22IvEHWzd6acr8ZKaqKJPpTWnmj9CQcCWCtYvECK h+U14VJ5D3B8xHVX3Vd6Cyw0hNvvdFk= X-Google-Smtp-Source: APiQypI7MaSZfHR50xdmKecIoqjfpJ8P58pS7zduAy9ZoGf+t2rVJ2nC2i5Z3MtzBmGlAo3ncMsDQg== X-Received: by 2002:a1c:e187:: with SMTP id y129mr4827715wmg.133.1588273291007; Thu, 30 Apr 2020 12:01:31 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 4/9] tests/tcg: drop inferior.was_attached() test Date: Thu, 30 Apr 2020 20:01:17 +0100 Message-Id: <20200430190122.4592-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430190122.4592-1-alex.bennee@linaro.org> References: <20200430190122.4592-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x330.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::330 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: Peter Maydell , "open list:ARM TCG CPUs" , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This test seems flaky and reports attachment even when we failed to negotiate the architecture. However the fetching of the guest architecture will fail tripping up the gdb AttributeError which will trigger our early no error status exit from the test Signed-off-by: Alex Benn=C3=A9e --- tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 3 --- tests/tcg/aarch64/gdbstub/test-sve.py | 3 --- 2 files changed, 6 deletions(-) diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py b/tests/tcg/aarch6= 4/gdbstub/test-sve-ioctl.py index 387b2fc20a..972cf73c31 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py +++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py @@ -58,9 +58,6 @@ def run_test(): # try: inferior =3D gdb.selected_inferior() - if inferior.was_attached =3D=3D False: - print("SKIPPING (failed to attach)", file=3Dsys.stderr) - exit(0) arch =3D inferior.architecture() report(arch.name() =3D=3D "aarch64", "connected to aarch64") except (gdb.error, AttributeError): diff --git a/tests/tcg/aarch64/gdbstub/test-sve.py b/tests/tcg/aarch64/gdbs= tub/test-sve.py index 5995689625..b96bdbb99a 100644 --- a/tests/tcg/aarch64/gdbstub/test-sve.py +++ b/tests/tcg/aarch64/gdbstub/test-sve.py @@ -59,9 +59,6 @@ def run_test(): # try: inferior =3D gdb.selected_inferior() - if inferior.was_attached =3D=3D False: - print("SKIPPING (failed to attach)", file=3Dsys.stderr) - exit(0) arch =3D inferior.architecture() report(arch.name() =3D=3D "aarch64", "connected to aarch64") except (gdb.error, AttributeError): --=20 2.20.1 From nobody Mon Feb 9 04:12:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588273682; cv=none; d=zohomail.com; s=zohoarc; b=IIMVxenppH6HKOzmrOkZptVyp1K9hLCvS1u5ZMQDykv7TfifusPjgUrcDnrHY1HxFOmuSvocYbBR2FPBMd5hhJuMx01lNfqn4isekG6ZzJavZAUeDuhfkWCDF4vEZ2owhn/n8LfRUFS0jyC1dVyZCQ1HtBzQNOrcKdn3hanVT54= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588273682; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=toymzPlUD26kqcownJZwCybn3HKvGbNcV/Ovby7lKh0=; b=YCLYC7gyr705zyAUCzprVVg73xT2fosS00+TbJENuK/m9VO01tHeM6QWTFaUfgcF1xlhakZMRSVRp5CecbNMMF+P/jhK6CGcn5w9UnZb7iRD8zKmfCnIryLOjRYhBWVVFd6I8rxiSyiVho6QlVGGVmTXbK+BSRn0OZk+Q0+c0m4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588273682959262.4055335205758; Thu, 30 Apr 2020 12:08:02 -0700 (PDT) Received: from localhost ([::1]:39764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUEXR-0000Cn-Km for importer@patchew.org; Thu, 30 Apr 2020 15:08:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43344) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUERF-0006GA-CG for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUERD-0003BJ-OI for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:37 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:35362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUERC-0003AQ-Vh for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:35 -0400 Received: by mail-wm1-x344.google.com with SMTP id r26so3320129wmh.0 for ; Thu, 30 Apr 2020 12:01:34 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l4sm852710wrv.60.2020.04.30.12.01.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:01:27 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 15D011FF91; Thu, 30 Apr 2020 20:01:23 +0100 (BST) 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=toymzPlUD26kqcownJZwCybn3HKvGbNcV/Ovby7lKh0=; b=UA3TKq51jiN8jju3lt/e2s4Tw6+F2WwjGMiFtuhMO0RTiJjAZnbem6Me68cwyCTqfh HniZx9+hmOMreg+MXn39JhnjrRurMli32Gy/BENikv8J5ivR8jz3JfjyerdjcUOgHiiL B30lv3QW+iN47NgwxUVYI7EJm+aTEducPqkcwSPzJDLO82Fd5N77XWGwkTOCDf0ttNe1 856KpTmj/beLKNl1/RrxkR5tOTVsW1x7x4rEhcRSLBRPuITTwRdE/q01QlC3bfQXv32E Zfcqf0OWxASg/Knl5SFcBXUPrN4Ah2cckAI+IEZ7GIv1BlUIgYq4TlVX2sPb5nPfJ4Br xQXw== 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=toymzPlUD26kqcownJZwCybn3HKvGbNcV/Ovby7lKh0=; b=lUMUGSGB01kGoK0kq2LNkrYBek1ilGa4nqGoIKVFoQj84K89F7vbp8NcIgsa1s9jU1 XPLojL2SDv1V3ZypbMqzsO5jMPG5o6LorR8jbecD2DAG/v4IWG8v4r9Dj+3mmbKr7HxL 5iEv+NF9FutSnqcza/38yfnW+eTRJtuUK+osWsnRWr0fshMhRwCLDYY3lbvJrZrgIBWm raqbv+MTZOlPWDppvlnTMIOpBL+AfmZLm28xirwbS2VDda6rMGwSe4O9MB+bV/MI/N1z FmA4ZF6IrSCyJKsHOCV7cGrYX5SXOHPtDuBMr81ME55xRvP3UyQ0+1YdKyWaOKwfe8z9 x76g== X-Gm-Message-State: AGi0PuZ3lIiNiegNdG5fC7E1dqFji+h+foUeFLJl3kqvs9pygdlBNLFF u94xI1kS/nhGye3CtV1FKWUXA5dXwtU= X-Google-Smtp-Source: APiQypLkQQz+FwwblWsH56zRPfNoGuTj1IwjpHCtmhXYfzw55xGvfgGlXOb8ZaNMMHXJ71Uaq1qUsg== X-Received: by 2002:a1c:44b:: with SMTP id 72mr54303wme.58.1588273293116; Thu, 30 Apr 2020 12:01:33 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 5/9] gdbstub: eliminate gdbserver_fd global Date: Thu, 30 Apr 2020 20:01:18 +0100 Message-Id: <20200430190122.4592-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430190122.4592-1-alex.bennee@linaro.org> References: <20200430190122.4592-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::344 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=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We don't really need to track this fd beyond the initial creation of the socket. We already know if the system has been initialised by virtue of the gdbserver_state so lets remove it. This makes the later re-factoring easier. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- v1 - fix coding style issue --- gdbstub.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/gdbstub.c b/gdbstub.c index 171e150950..b5381aa520 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -398,8 +398,6 @@ static void reset_gdbserver_state(void) bool gdb_has_xml; =20 #ifdef CONFIG_USER_ONLY -/* XXX: This is not thread safe. Do we care? */ -static int gdbserver_fd =3D -1; =20 static int get_char(void) { @@ -2964,7 +2962,7 @@ void gdb_exit(CPUArchState *env, int code) return; } #ifdef CONFIG_USER_ONLY - if (gdbserver_fd < 0 || gdbserver_state.fd < 0) { + if (gdbserver_state.fd < 0) { return; } #endif @@ -3011,7 +3009,7 @@ gdb_handlesig(CPUState *cpu, int sig) char buf[256]; int n; =20 - if (gdbserver_fd < 0 || gdbserver_state.fd < 0) { + if (!gdbserver_state.init || gdbserver_state.fd < 0) { return sig; } =20 @@ -3060,7 +3058,7 @@ void gdb_signalled(CPUArchState *env, int sig) { char buf[4]; =20 - if (gdbserver_fd < 0 || gdbserver_state.fd < 0) { + if (!gdbserver_state.init || gdbserver_state.fd < 0) { return; } =20 @@ -3068,7 +3066,7 @@ void gdb_signalled(CPUArchState *env, int sig) put_packet(buf); } =20 -static bool gdb_accept(void) +static bool gdb_accept(int gdb_fd) { struct sockaddr_in sockaddr; socklen_t len; @@ -3076,7 +3074,7 @@ static bool gdb_accept(void) =20 for(;;) { len =3D sizeof(sockaddr); - fd =3D accept(gdbserver_fd, (struct sockaddr *)&sockaddr, &len); + fd =3D accept(gdb_fd, (struct sockaddr *)&sockaddr, &len); if (fd < 0 && errno !=3D EINTR) { perror("accept"); return false; @@ -3137,13 +3135,13 @@ static int gdbserver_open(int port) =20 int gdbserver_start(int port) { - gdbserver_fd =3D gdbserver_open(port); - if (gdbserver_fd < 0) + int gdb_fd =3D gdbserver_open(port); + if (gdb_fd < 0) { return -1; + } /* accept connections */ - if (!gdb_accept()) { - close(gdbserver_fd); - gdbserver_fd =3D -1; + if (!gdb_accept(gdb_fd)) { + close(gdb_fd); return -1; } return 0; @@ -3152,7 +3150,7 @@ int gdbserver_start(int port) /* Disable gdb stub for child processes. */ void gdbserver_fork(CPUState *cpu) { - if (gdbserver_fd < 0 || gdbserver_state.fd < 0) { + if (!gdbserver_state.init || gdbserver_state.fd < 0) { return; } close(gdbserver_state.fd); --=20 2.20.1 From nobody Mon Feb 9 04:12:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588273683; cv=none; d=zohomail.com; s=zohoarc; b=Mya8JkUaWFQjG0MS2MK4x+hrrxsLp+2RiOnwUCJ2DY6fhJnhhrWLItFJ05MnpD0Mrtgpm5FE9FO4Bt3kcALKeWiFJTnV7H821sFRobxJEUHWHkMyxXhdT0+A7TwC3BHVp9PEY4+5u1/cFrCbW/UeDvIAQHoq7CCzMekVof+wZKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588273683; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eawQ/bI9+XycEW6hWFjbMLsFQnZ4HXBvVhHIulSVMTw=; b=JUk9ksfODjqkW+Ge+smoRu1CATt5Rei5PG9eH4h4uCVlltmxPUkL8pES34oFvK9Uwsr6ETbExC2uKPGYPp9mAjmGCv8QIuYM04dpvKGSBHrJZ1pYCWRA33r4JR7skOp2r6DJvM6vIMWqc9Q2p2my8FhNCXLaQuI0ctakBiIwrmg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588273683011251.15434498801187; Thu, 30 Apr 2020 12:08:03 -0700 (PDT) Received: from localhost ([::1]:39756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUEXR-0000CT-GG for importer@patchew.org; Thu, 30 Apr 2020 15:08:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43370) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUERH-0006Jj-MH for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUERF-0003CB-MB for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:39 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:38101) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUERF-0003BW-92 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:37 -0400 Received: by mail-wm1-x343.google.com with SMTP id g12so3308330wmh.3 for ; Thu, 30 Apr 2020 12:01:36 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n2sm838522wrq.74.2020.04.30.12.01.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:01:27 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 307CD1FF92; Thu, 30 Apr 2020 20:01:23 +0100 (BST) 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=eawQ/bI9+XycEW6hWFjbMLsFQnZ4HXBvVhHIulSVMTw=; b=wzWSP2mopg90J/CTW+17gjNeFsy9LA+CdERnXDH/FbB1knB9oSQbAXP4j6AOh/mXfR tHgJQEYylMIM4Uwldu8yEQ8b6CZKp/j4olkH6vRQocvZz7Lu3kygUTqUy776i+jEbvg0 SHwLTy2l5oTvLoSVTK/1jWpF4T0i0SkUgdsGC6H3Mj6oytWtrWcL9uILcdHcEJG2Bcti xjHMwm2wiwNTLrPpu37uAsRsVSgi7E3llDrvs5OhowJi44Gikn30kp2b02VJVTJDf48P VZWrf8u2gh7oO+2JDSt+kFAuVekRk1CmOrVD7ME6tEyMu2GOe8jYuApg58ZGwsmWA4Fw +z7g== 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=eawQ/bI9+XycEW6hWFjbMLsFQnZ4HXBvVhHIulSVMTw=; b=UL/XtFLQgib2nKSfLQ3ZqcYLDkdtSXc/tBU69yZ8dU7+iPLp8QW8liNEtLkM2BUUuI rntknZVRuIOzdu4komC56sF+URz2nqs/TdPjubv1dF4dJmSGO1Y50KZtFQDlK4T+F9M9 WQCNj9Vjq+lZF53BPlN/++qAu6346CLQctfKEzuLqDN+hNbBpz48VhhgFXLK4zrWTo1E s5I5VSuzL3ILwt0YkQbhOv7ZCI5TRCN6DUvZ4/gfSfGTgGRMXmcKtiBjINLDQ+pFG5EX V1n6l91NG97nqZZu+98/CR1X2hyLwXdfgnQBOpPE60YondXQMfg7ngDkvt7f+1+F1vU1 IFmA== X-Gm-Message-State: AGi0Pubv2ao+9/cwLe7RA3wO/G4oDWPOVP50AN6GUqIRYak+igZfZZ6M LrB1T2Owzf+qcmzWyUy+fJHDPQ== X-Google-Smtp-Source: APiQypK5pKkvqVaNqK5qtdRrlxYeprcbCld7+zSlfMfKP1ZGe2tcBg/T2VCzrVa9a+Vtr96+ZhYuxA== X-Received: by 2002:a05:600c:24cf:: with SMTP id 15mr41856wmu.94.1588273295688; Thu, 30 Apr 2020 12:01:35 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 6/9] gdbstub/linux-user: support debugging over a unix socket Date: Thu, 30 Apr 2020 20:01:19 +0100 Message-Id: <20200430190122.4592-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430190122.4592-1-alex.bennee@linaro.org> References: <20200430190122.4592-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::343 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=20Mathieu-Daud=C3=A9?= , Riku Voipio , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) While debugging over TCP is fairly straightforward now we have test cases that want to orchestrate via make and currently a parallel build fails as two processes can't use the same listening port. While system emulation offers a wide cornucopia of connection methods thanks to the chardev abstraction we are a little more limited for linux user. Thankfully the programming API for a TCP socket and a local UNIX socket is pretty much the same once it's set up. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- include/exec/gdbstub.h | 14 ++++-- bsd-user/main.c | 8 ++-- gdbstub.c | 103 ++++++++++++++++++++++++++++++++++------- linux-user/main.c | 12 ++--- 4 files changed, 106 insertions(+), 31 deletions(-) diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 4a2b8e3089..94d8f83e92 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -177,11 +177,15 @@ static inline uint8_t * gdb_get_reg_ptr(GByteArray *b= uf, int len) =20 #endif =20 -#ifdef CONFIG_USER_ONLY -int gdbserver_start(int); -#else -int gdbserver_start(const char *port); -#endif +/** + * gdbserver_start: start the gdb server + * @port_or_device: connection spec for gdb + * + * For CONFIG_USER this is either a tcp port or a path to a fifo. For + * system emulation you can use a full chardev spec for your gdbserver + * port. + */ +int gdbserver_start(const char *port_or_device); =20 void gdbserver_cleanup(void); =20 diff --git a/bsd-user/main.c b/bsd-user/main.c index 770c2b267a..28f122b80e 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -738,7 +738,7 @@ int main(int argc, char **argv) CPUState *cpu; int optind; const char *r; - int gdbstub_port =3D 0; + const char *gdbstub =3D NULL; char **target_environ, **wrk; envlist_t *envlist =3D NULL; char *trace_file =3D NULL; @@ -814,7 +814,7 @@ int main(int argc, char **argv) exit(1); } } else if (!strcmp(r, "g")) { - gdbstub_port =3D atoi(argv[optind++]); + gdbstub =3D g_strdup(argv[optind++]); } else if (!strcmp(r, "r")) { qemu_uname_release =3D argv[optind++]; } else if (!strcmp(r, "cpu")) { @@ -1124,8 +1124,8 @@ int main(int argc, char **argv) #error unsupported target CPU #endif =20 - if (gdbstub_port) { - gdbserver_start (gdbstub_port); + if (gdbstub) { + gdbserver_start(gdbstub); gdb_handlesig(cpu, 0); } cpu_loop(env); diff --git a/gdbstub.c b/gdbstub.c index b5381aa520..6950fd243f 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -355,6 +355,7 @@ typedef struct GDBState { int signal; #ifdef CONFIG_USER_ONLY int fd; + char *socket_path; int running_state; #else CharBackend chr; @@ -2962,6 +2963,9 @@ void gdb_exit(CPUArchState *env, int code) return; } #ifdef CONFIG_USER_ONLY + if (gdbserver_state.socket_path) { + unlink(gdbserver_state.socket_path); + } if (gdbserver_state.fd < 0) { return; } @@ -3066,7 +3070,66 @@ void gdb_signalled(CPUArchState *env, int sig) put_packet(buf); } =20 -static bool gdb_accept(int gdb_fd) +static void gdb_accept_init(int fd) +{ + init_gdbserver_state(); + create_default_process(&gdbserver_state); + gdbserver_state.processes[0].attached =3D true; + gdbserver_state.c_cpu =3D gdb_first_attached_cpu(); + gdbserver_state.g_cpu =3D gdbserver_state.c_cpu; + gdbserver_state.fd =3D fd; + gdb_has_xml =3D false; +} + +static bool gdb_accept_socket(int gdb_fd) +{ + int fd; + + for(;;) { + fd =3D accept(gdb_fd, NULL, NULL); + if (fd < 0 && errno !=3D EINTR) { + perror("accept socket"); + return false; + } else if (fd >=3D 0) { + qemu_set_cloexec(fd); + break; + } + } + + gdb_accept_init(fd); + return true; +} + +static int gdbserver_open_socket(const char *path) +{ + struct sockaddr_un sockaddr; + int fd, ret; + + fd =3D socket(AF_UNIX, SOCK_STREAM, 0); + if (fd < 0) { + perror("create socket"); + return -1; + } + + sockaddr.sun_family =3D AF_UNIX; + pstrcpy(sockaddr.sun_path, sizeof(sockaddr.sun_path) - 1, path); + ret =3D bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)); + if (ret < 0) { + perror("bind socket"); + close(fd); + return -1; + } + ret =3D listen(fd, 1); + if (ret < 0) { + perror("listen socket"); + close(fd); + return -1; + } + + return fd; +} + +static bool gdb_accept_tcp(int gdb_fd) { struct sockaddr_in sockaddr; socklen_t len; @@ -3091,17 +3154,11 @@ static bool gdb_accept(int gdb_fd) return false; } =20 - init_gdbserver_state(); - create_default_process(&gdbserver_state); - gdbserver_state.processes[0].attached =3D true; - gdbserver_state.c_cpu =3D gdb_first_attached_cpu(); - gdbserver_state.g_cpu =3D gdbserver_state.c_cpu; - gdbserver_state.fd =3D fd; - gdb_has_xml =3D false; + gdb_accept_init(fd); return true; } =20 -static int gdbserver_open(int port) +static int gdbserver_open_port(int port) { struct sockaddr_in sockaddr; int fd, ret; @@ -3130,21 +3187,35 @@ static int gdbserver_open(int port) close(fd); return -1; } + return fd; } =20 -int gdbserver_start(int port) +int gdbserver_start(const char *port_or_path) { - int gdb_fd =3D gdbserver_open(port); + int port =3D g_ascii_strtoull(port_or_path, NULL, 10); + int gdb_fd; + + if (port > 0) { + gdb_fd =3D gdbserver_open_port(port); + } else { + gdb_fd =3D gdbserver_open_socket(port_or_path); + } + if (gdb_fd < 0) { return -1; } - /* accept connections */ - if (!gdb_accept(gdb_fd)) { - close(gdb_fd); - return -1; + + if (port > 0 && gdb_accept_tcp(gdb_fd)) { + return 0; + } else if (gdb_accept_socket(gdb_fd)) { + gdbserver_state.socket_path =3D g_strdup(port_or_path); + return 0; } - return 0; + + /* gone wrong */ + close(gdb_fd); + return -1; } =20 /* Disable gdb stub for child processes. */ diff --git a/linux-user/main.c b/linux-user/main.c index 22578b1633..2cd443237d 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -51,7 +51,7 @@ char *exec_path; =20 int singlestep; static const char *argv0; -static int gdbstub_port; +static const char *gdbstub; static envlist_t *envlist; static const char *cpu_model; static const char *cpu_type; @@ -310,7 +310,7 @@ static void handle_arg_seed(const char *arg) =20 static void handle_arg_gdb(const char *arg) { - gdbstub_port =3D atoi(arg); + gdbstub =3D g_strdup(arg); } =20 static void handle_arg_uname(const char *arg) @@ -861,10 +861,10 @@ int main(int argc, char **argv, char **envp) =20 target_cpu_copy_regs(env, regs); =20 - if (gdbstub_port) { - if (gdbserver_start(gdbstub_port) < 0) { - fprintf(stderr, "qemu: could not open gdbserver on port %d\n", - gdbstub_port); + if (gdbstub) { + if (gdbserver_start(gdbstub) < 0) { + fprintf(stderr, "qemu: could not open gdbserver on %s\n", + gdbstub); exit(EXIT_FAILURE); } gdb_handlesig(cpu, 0); --=20 2.20.1 From nobody Mon Feb 9 04:12:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588273775; cv=none; d=zohomail.com; s=zohoarc; b=CnyX1NcwDHbfh56loC7q8aQkAo1+FzmqNDgMDzK0qG+L7h10YXwTgbBuIZd+yZNZpkCHk5qi0e/g3GSQRj4UsnXquRbzofhVPiAlVen0FvPzCGnxVBNowcTm6zZOiocjMKg9DjKtOEJXk92epmo8lbvxEZ62PKkCosZpdTHMCqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588273775; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vsRaPQgPWjspWGA09bn/H8qfGOOUy5/7Otme35R+WfU=; b=U+QPju9BLU6Ji2gp+KA4Tu+vrREflnFCMpHV5JeHJQTFnFyow/C8iMPA5OoT69MUNXbIqRd+04flBfs8NFsuN9UGBVhjIMq5ou05vw+0H8qAEMWiJBnqkoa/jCwdehP87fImNdpqOmSghj39QD0Gyp8re+bpCu1DvpQq1oEVlOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15882737752091013.0558110125917; Thu, 30 Apr 2020 12:09:35 -0700 (PDT) Received: from localhost ([::1]:46140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUEYv-0002zt-QY for importer@patchew.org; Thu, 30 Apr 2020 15:09:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43366) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUERH-0006JB-B9 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUERG-0003CS-H4 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:39 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:37057) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUERF-0003Bw-Ql for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:38 -0400 Received: by mail-wm1-x342.google.com with SMTP id z6so3317976wml.2 for ; Thu, 30 Apr 2020 12:01:37 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u3sm808638wrt.93.2020.04.30.12.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:01:29 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 466821FF93; Thu, 30 Apr 2020 20:01:23 +0100 (BST) 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=vsRaPQgPWjspWGA09bn/H8qfGOOUy5/7Otme35R+WfU=; b=Zt487m8K8k279WZYkb87i8qKd6jadZ01ztkCPB2S+NRLtBdNGqrmwgb+Z4TDg/1QTV E0ILckzz/5dYesbKlFoE4PlEifErWm1CJV0cLdE+LZ4OytoYuuHTwBOy55vO/n1wBY8+ +A4Vg5ec15a6u/SqiUOjQFRga1XfTzRKBcAWo/dM1lgjFZk1HZ9EXBVoNOoF11dtIVNQ hUK3g4jfksJwfKpBrgWQfLjTE41oHwM49N7f+7U+pTBSRVOuymLIWOyoXN5f02UPLZws Uq9KCJlYWoOIPJIicGOhMh+zJYYR7EaiTk5jxkv5JzZ5vBEijNXLfe6foYfaTXXPBEV5 8maA== 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=vsRaPQgPWjspWGA09bn/H8qfGOOUy5/7Otme35R+WfU=; b=EemATmeI9D636DInmJcgrL5SMHjo0ndZgpQgdQcgzi7G+x3+v1ezRx0InHXvrIyxFv njoW1ic4DNE4QoKS8tDb23PULCZG7cim6kwSPFPZJj/1mkJVYRc8QzbsnP2IaJ99n0Wb W7jd1r32/DaT9RdrmXdQWJovIsbK2zdvLitPsZ1k5PzTGW/9gIbW001r+Yi06djiA5Oj GG7P8oUa3O1Sefv/nTvTN8I7S5fVZLzqJHTGdod9G9I+xSZF+VZD+vv50vrXUTMjTqqI UUDW0JHGRHXlbSTuQd6iokfVweosfOejJ50mw6oTka37dTMCiT6/rufVRhq1njUlL4jU PrtQ== X-Gm-Message-State: AGi0PuZuACnONS5m9aqAfX2sntEl96womxpZQSgIwcfABGkMRLAUnQW5 AQbN2z2NJYvhfqPCzL5QAamb4HKpwHg= X-Google-Smtp-Source: APiQypLVJBOaklwhLZ8meiZ4uTPoSRuyAVg31tC9c2CV9c7IlGWUz1sM0iyRpg2TKyJVJeHqbOv5kQ== X-Received: by 2002:a1c:4409:: with SMTP id r9mr4672434wma.165.1588273296373; Thu, 30 Apr 2020 12:01:36 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 7/9] tests/guest-debug: use the unix socket for linux-user tests Date: Thu, 30 Apr 2020 20:01:20 +0100 Message-Id: <20200430190122.4592-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430190122.4592-1-alex.bennee@linaro.org> References: <20200430190122.4592-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::342 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=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Now we have support for debugging over a unix socket for linux-user lets use it in our test harness. Signed-off-by: Alex Benn=C3=A9e --- tests/guest-debug/run-test.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 2bbb8fbaa3..d9af9573b9 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -15,6 +15,8 @@ import argparse import subprocess import shutil import shlex +import os +from tempfile import TemporaryDirectory =20 def get_args(): parser =3D argparse.ArgumentParser(description=3D"A gdbstub test runne= r") @@ -41,11 +43,15 @@ if __name__ =3D=3D '__main__': print("We need gdb to run the test") exit(-1) =20 + socket_dir =3D TemporaryDirectory("qemu-gdbstub") + socket_name =3D os.path.join(socket_dir.name, "gdbstub.socket") + # Launch QEMU with binary if "system" in args.qemu: cmd =3D "%s %s %s -s -S" % (args.qemu, args.qargs, args.binary) else: - cmd =3D "%s %s -g 1234 %s" % (args.qemu, args.qargs, args.binary) + cmd =3D "%s %s -g %s %s" % (args.qemu, args.qargs, socket_name, + args.binary) =20 inferior =3D subprocess.Popen(shlex.split(cmd)) =20 @@ -56,7 +62,10 @@ if __name__ =3D=3D '__main__': # disable prompts in case of crash gdb_cmd +=3D " -ex 'set confirm off'" # connect to remote - gdb_cmd +=3D " -ex 'target remote localhost:1234'" + if "system" in args.qemu: + gdb_cmd +=3D " -ex 'target remote localhost:1234'" + else: + gdb_cmd +=3D " -ex 'target remote %s'" % (socket_name) # finally the test script itself gdb_cmd +=3D " -x %s" % (args.test) =20 --=20 2.20.1 From nobody Mon Feb 9 04:12:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588273566; cv=none; d=zohomail.com; s=zohoarc; b=PpZvk/AkPi7LDPxY7R7A06MsFU2W4cu09zInDylXRgt+bW33WxCv7clp0DvSf0WSIOU1FKylRnvWo6VzsefYOy2golSfFPdKaaswVJBMxhMbbu7AglnDYFsYdG7sP7FxbpfioJ2ujddwfFmvGVo9HRzY89WUTYSkfK5HCbyi9jo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588273566; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=67oQwpEs2PvLm/27/7hAV2hnOAJBQY7TkPiq2zfh6Fw=; b=brZsSCsqzYa+Cn2UIMaxD4zKfthIvxnCV8TEBZSqgbPl66CHVOABj8J1zbmJqccKAnz8EynUsk87TE0aCe+Bx2piy8yUtn0Lb0r+Kzidp6/3jthN8NkdAqX+JCs7GySorCvr9uoxgOAo/5atBrgxbP6LXB5rD1qt+KIFDO0SYrU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588273566649327.1740309668495; Thu, 30 Apr 2020 12:06:06 -0700 (PDT) Received: from localhost ([::1]:59962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUEVZ-0003lb-7c for importer@patchew.org; Thu, 30 Apr 2020 15:06:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43412) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUERL-0006R3-LY for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUERI-0003D8-DR for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:43 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:36267) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUERH-0003Cf-T7 for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:39 -0400 Received: by mail-wr1-x442.google.com with SMTP id d15so8437933wrx.3 for ; Thu, 30 Apr 2020 12:01:39 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o3sm901426wru.68.2020.04.30.12.01.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:01:29 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 61F981FF96; Thu, 30 Apr 2020 20:01:23 +0100 (BST) 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=67oQwpEs2PvLm/27/7hAV2hnOAJBQY7TkPiq2zfh6Fw=; b=S8QxSurdO7IyfpJsdMm3hepzgUi8sYTZdEzzWBJeUUvIQEaAsMS0VVUfHH0BfdpQDg XP1nAAOB3Ux/bZJf038+7INrQFwhVbfKfPF01cwtbWeKq4H8lq2gkaYQJb7fx6Mig395 apvWtPb3MqG8kmnCbsnEsuyO0p9ma5TgNR3h/2+MpJk3tn6YLQ7BaSgswlFzyuIycB0v Zo5tUhM3gbUvqtXEOx8jfRi+/kRVjmN/+Efk6yKgW1tvHb/oXlfgSymT8rTsnGqB826s dpbiTE9O/OfNu+y6kL8qgz5WsEJHrZAOsfqVamN4AeY3scifkhieyA42W+RF/4wgDRuo 0K1w== 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=67oQwpEs2PvLm/27/7hAV2hnOAJBQY7TkPiq2zfh6Fw=; b=Jts6Tz56UG47tuv91iIyMSZbP5o7VbJJdtN0Com7RuUSAdzsSsoYEDBkkoLLxnMn2C gsIetx8wIR2AZKf1YWin4nURiEDTHJpa7ZM9EKGFidnQ7zoj0XJLgZ9V2GNT9wJO6a+J dw8ziMEd+esUPTYLDMd0K67LW/esaYTSMKG8O8KPlI5NHDalp73mtMooVsNFTCFGKV2h xRD1QL6A9ZWQ34mzGehjM3FSkyZ17CIkZdQ51c3yLPoPfkHCcTV9AbIa6WcvNybzJ7JA wWOx/dxbfYxITzy4kLMX+7NIK5Hl/wc4W7ZKG/rIqCu/kXnKh4Hyr+J5h4HGUIyYsrka dK/g== X-Gm-Message-State: AGi0PuZ73BatkJ4BVTWSTmDx2ekEGrjtFgDFhpSFB27oXwvkbKEBuO+N /quJaErePrYrh2cpA4ZyuaQhLQ== X-Google-Smtp-Source: APiQypL6pJlC02ZJa/rwEdW9B/GzEJDuCcJEwxfBkf4MuH9pdFwmSBe8IwtswKiyUov2OkApW9FiYg== X-Received: by 2002:adf:cc8d:: with SMTP id p13mr16315wrj.114.1588273298361; Thu, 30 Apr 2020 12:01:38 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 8/9] tests/tcg: add a multiarch linux-user gdb test Date: Thu, 30 Apr 2020 20:01:21 +0100 Message-Id: <20200430190122.4592-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430190122.4592-1-alex.bennee@linaro.org> References: <20200430190122.4592-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::442 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: Peter Maydell , "open list:ARM TCG CPUs" , =?UTF-8?q?Alex=20Benn=C3=A9e?= , "Edgar E. Iglesias" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When the gdbstub code was converted to the new API we missed a few snafus in the various guests. Add a simple gdb test script which can be used on all our linux-user guests to check for obvious failures. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- v2 - use EXTRA_RUNS to queue the tests so as not to break plugins --- tests/tcg/aarch64/Makefile.target | 5 +- tests/tcg/cris/Makefile.target | 1 + tests/tcg/multiarch/Makefile.target | 14 +++++ tests/tcg/multiarch/gdbstub/sha1.py | 81 +++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 tests/tcg/multiarch/gdbstub/sha1.py diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index d99b2a9ece..312f36cde5 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -54,9 +54,6 @@ sve-ioctls: CFLAGS+=3D-march=3Darmv8.1-a+sve ifneq ($(HAVE_GDB_BIN),) GDB_SCRIPT=3D$(SRC_PATH)/tests/guest-debug/run-test.py =20 -AARCH64_TESTS +=3D gdbstub-sysregs gdbstub-sve-ioctls - -.PHONY: gdbstub-sysregs gdbstub-sve-ioctls run-gdbstub-sysregs: sysregs $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(HAVE_GDB_BIN) \ @@ -70,6 +67,8 @@ run-gdbstub-sve-ioctls: sve-ioctls --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \ "basic gdbstub SVE ZLEN support") + +EXTRA_RUNS +=3D run-gdbstub-sysregs run-gdbstub-sve-ioctls endif =20 endif diff --git a/tests/tcg/cris/Makefile.target b/tests/tcg/cris/Makefile.target index 24c7f2e761..e72d3cbdb2 100644 --- a/tests/tcg/cris/Makefile.target +++ b/tests/tcg/cris/Makefile.target @@ -23,6 +23,7 @@ CRIS_RUNS =3D $(patsubst %, run-%, $(CRIS_USABLE_TESTS)) =20 # override the list of tests, as we can't build the multiarch tests TESTS =3D $(CRIS_USABLE_TESTS) +EXTRA_RUNS =3D VPATH =3D $(CRIS_SRC) =20 AS =3D $(CC) -x assembler-with-cpp diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Make= file.target index 035b09c853..51fb75ecfd 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -42,5 +42,19 @@ run-test-mmap-%: test-mmap $(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\ "$< ($* byte pages) on $(TARGET_NAME)") =20 +ifneq ($(HAVE_GDB_BIN),) +GDB_SCRIPT=3D$(SRC_PATH)/tests/guest-debug/run-test.py + +run-gdbstub-sha1: sha1 + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(HAVE_GDB_BIN) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ + "basic gdbstub support") + +EXTRA_RUNS +=3D run-gdbstub-sha1 +endif + + # Update TESTS TESTS +=3D $(MULTIARCH_TESTS) diff --git a/tests/tcg/multiarch/gdbstub/sha1.py b/tests/tcg/multiarch/gdbs= tub/sha1.py new file mode 100644 index 0000000000..734553b98b --- /dev/null +++ b/tests/tcg/multiarch/gdbstub/sha1.py @@ -0,0 +1,81 @@ +from __future__ import print_function +# +# A very simple smoke test for debugging the SHA1 userspace test on +# each target. +# +# This is launched via tests/guest-debug/run-test.py +# + +import gdb +import sys + +initial_vlen =3D 0 +failcount =3D 0 + +def report(cond, msg): + "Report success/fail of test" + if cond: + print("PASS: %s" % (msg)) + else: + print("FAIL: %s" % (msg)) + global failcount + failcount +=3D 1 + +def check_break(sym_name): + "Setup breakpoint, continue and check we stopped." + sym, ok =3D gdb.lookup_symbol(sym_name) + bp =3D gdb.Breakpoint(sym_name) + + gdb.execute("c") + + # hopefully we came back + end_pc =3D gdb.parse_and_eval('$pc') + report(bp.hit_count =3D=3D 1, + "break @ %s (%s %d hits)" % (end_pc, sym.value(), bp.hit_count)) + + bp.delete() + +def run_test(): + "Run through the tests one by one" + + check_break("SHA1Init") + + # check step and inspect values + gdb.execute("next") + val_ctx =3D gdb.parse_and_eval("context->state[0]") + exp_ctx =3D 0x67452301 + report(int(val_ctx) =3D=3D exp_ctx, "context->state[0] =3D=3D %x" % ex= p_ctx); + + gdb.execute("next") + val_ctx =3D gdb.parse_and_eval("context->state[1]") + exp_ctx =3D 0xEFCDAB89 + report(int(val_ctx) =3D=3D exp_ctx, "context->state[1] =3D=3D %x" % ex= p_ctx); + + # finally check we don't barf inspecting registers + gdb.execute("info registers") + +# +# This runs as the script it sourced (via -x, via run-test.py) +# +try: + inferior =3D gdb.selected_inferior() + arch =3D inferior.architecture() + print("ATTACHED: %s" % arch.name()) +except (gdb.error, AttributeError): + print("SKIPPING (not connected)", file=3Dsys.stderr) + 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 +=3D 1 + pass + +print("All tests complete: %d failures" % failcount) +exit(failcount) --=20 2.20.1 From nobody Mon Feb 9 04:12:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1588273821; cv=none; d=zohomail.com; s=zohoarc; b=DH96BllpNbLe4J5Iqtd/412P9fi/qSoRLluk62/hTH748UiFlcH+lwI+iGw39bdkVjeAgtE0QlGA9p64jK2anzaWquYdvM8OsGMCR85ofaCaAIEHGiezr95z1y2uQVJZktl/+i1+F/wdo3vciT4RvL3vGv1nUOyk94BMotxasM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588273821; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jncaEdnvbauDXCU17XPkj/Wu9+gTneiy7ioQjveouRU=; b=Z181X85xcpWgezJlFK9wCvVtO5dW4Uz+4exwzb0CJOrrVDSu2d+CRi/YRZThNEGODk12LTbIBMVl7/K8qPsMazQNe3rv2w29nEefHQoYHgFVXa7N7L7RHlloMvaHwuQG7b+pfrDkgM+g9Qjf6UZV1cpqF0Gwauo+KgYuk4ruLDI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1588273821883375.23449142566506; Thu, 30 Apr 2020 12:10:21 -0700 (PDT) Received: from localhost ([::1]:49806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUEZg-0004V3-Lj for importer@patchew.org; Thu, 30 Apr 2020 15:10:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43418) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUERM-0006SK-Ar for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUERK-0003E6-Jy for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:44 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:33832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUERK-0003DM-4s for qemu-devel@nongnu.org; Thu, 30 Apr 2020 15:01:42 -0400 Received: by mail-wr1-x442.google.com with SMTP id j1so8448563wrt.1 for ; Thu, 30 Apr 2020 12:01:41 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id k133sm843237wma.0.2020.04.30.12.01.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 12:01:35 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7B7F11FF98; Thu, 30 Apr 2020 20:01:23 +0100 (BST) 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=jncaEdnvbauDXCU17XPkj/Wu9+gTneiy7ioQjveouRU=; b=ziwAXXOWQdxiXNfuRyMbYPTnjsHZo8pcOh2/qkvv6X9ClDJkDWDy7tVx815DWnqSNZ o3w1M2AO/ZysMxuVmaFqRTO0Opm2vbxOdSTXlukGbx2t3UZyvkI8E+T6dIKU0+cMVCfb 1I8uWSXxPANnB1nkjFcoEF807NfUiBGPFsJWB1ILJnbk1XCDVIc/Kpjf3q6XnLvEAROl 6dyjixvjd+mxU7gW2k/tpgr0wVb8ghPkVSu95xuz1AzeIcwNjRaoAwbUEXrm0KiDY5p1 R7jmPy7hspek6SUCdN48N5YSCH/pQEuo7flrOkhkJn0a2S+S8Gwa1FcMiWyI2GZ9zvtd Ev8Q== 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=jncaEdnvbauDXCU17XPkj/Wu9+gTneiy7ioQjveouRU=; b=FyyVIcu3SXTFqPtVcPbvDK3m7XADt6ElM7NDj7f5NM+tGVTIpNEJLn0PXfthlxPjAx FxwwVoqfKtrXeCfS5TBzW0/BCmTcHpG4UwCj1mwtXozEKQgeUSqGD6lc4RdXdUFN95sy 17hTPibBTGQGlNF0MQOnQvG/dxIJO8kOuDySE0wFU+UwDWnAqRCAVbT7kRbKq9eG5rR7 kE7wkjZ+uhE9dIok8lKcC8LCrOY4X6q/fW6Q3LuJpUcXDcVeGX2ZoFjRwUa2t0MYsvs3 KvoteeR4IRh4BhUkZkWBxLA7tklwskgPcXpoMFFCDPO4icPfogNi8lYTQ3GyGL9qzqfb 3+Zg== X-Gm-Message-State: AGi0PuZ6rhcgOEArwrK/dt3S37r+jX8FQht0bPSe8msvJD4gowyNgFc5 CKctH4GNF+bfHcDkJKm1ZpbCvg== X-Google-Smtp-Source: APiQypL4Bo0agFu/yLoVsAblXf5ThQd5FFaMFbUmvrK840AFcX5zzBTL1ABfLfdT92ODUdcnU+hLog== X-Received: by 2002:adf:fe44:: with SMTP id m4mr7659wrs.188.1588273300580; Thu, 30 Apr 2020 12:01:40 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 9/9] target/m68k: fix gdb for m68xxx Date: Thu, 30 Apr 2020 20:01:22 +0100 Message-Id: <20200430190122.4592-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200430190122.4592-1-alex.bennee@linaro.org> References: <20200430190122.4592-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::442 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=20Mathieu-Daud=C3=A9?= , KONRAD Frederic , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: KONRAD Frederic Currently "cf-core.xml" is sent to GDB when using any m68k flavor. Thing is it uses the "org.gnu.gdb.coldfire.core" feature name and gdb 8.3 then expec= ts a coldfire FPU instead of the default m68881 FPU. This is not OK because the m68881 floats registers are 96 bits wide so it crashes GDB with the following error message: (gdb) target remote localhost:7960 Remote debugging using localhost:7960 warning: Register "fp0" has an unsupported size (96 bits) warning: Register "fp1" has an unsupported size (96 bits) ... Remote 'g' packet reply is too long (expected 148 bytes, got 180 bytes): = \ 00000000000[...]0000 With this patch: qemu-system-m68k -M none -cpu m68020 -s -S (gdb) tar rem :1234 Remote debugging using :1234 warning: No executable has been specified and target does not support determining executable automatically. Try using the "file" command. 0x00000000 in ?? () (gdb) p $fp0 $1 =3D nan(0xffffffffffffffff) Signed-off-by: KONRAD Frederic Signed-off-by: Alex Benn=C3=A9e Message-Id: <1588094279-17913-3-git-send-email-frederic.konrad@adacore.com> Reviewed-by: Laurent Vivier Reviewed-by: Richard Henderson --- configure | 2 +- target/m68k/cpu.c | 52 ++++++++++++++++++++++++++++++------------- gdb-xml/m68k-core.xml | 29 ++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 16 deletions(-) create mode 100644 gdb-xml/m68k-core.xml diff --git a/configure b/configure index c58787100f..0d69c360c0 100755 --- a/configure +++ b/configure @@ -7825,7 +7825,7 @@ case "$target_name" in ;; m68k) bflt=3D"yes" - gdb_xml_files=3D"cf-core.xml cf-fp.xml m68k-fp.xml" + gdb_xml_files=3D"cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml" TARGET_SYSTBL_ABI=3Dcommon ;; microblaze|microblazeel) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 9445fcd6df..72c545149e 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -292,16 +292,38 @@ static void m68k_cpu_class_init(ObjectClass *c, void = *data) cc->tcg_initialize =3D m68k_tcg_init; =20 cc->gdb_num_core_regs =3D 18; - cc->gdb_core_xml_file =3D "cf-core.xml"; =20 dc->vmsd =3D &vmstate_m68k_cpu; } =20 -#define DEFINE_M68K_CPU_TYPE(cpu_model, initfn) \ - { \ - .name =3D M68K_CPU_TYPE_NAME(cpu_model), \ - .instance_init =3D initfn, \ - .parent =3D TYPE_M68K_CPU, \ +static void m68k_cpu_class_init_cf_core(ObjectClass *c, void *data) +{ + CPUClass *cc =3D CPU_CLASS(c); + + cc->gdb_core_xml_file =3D "cf-core.xml"; +} + +#define DEFINE_M68K_CPU_TYPE_CF(model) \ + { \ + .name =3D M68K_CPU_TYPE_NAME(#model), \ + .instance_init =3D model##_cpu_initfn, \ + .parent =3D TYPE_M68K_CPU, \ + .class_init =3D m68k_cpu_class_init_cf_core \ + } + +static void m68k_cpu_class_init_m68k_core(ObjectClass *c, void *data) +{ + CPUClass *cc =3D CPU_CLASS(c); + + cc->gdb_core_xml_file =3D "m68k-core.xml"; +} + +#define DEFINE_M68K_CPU_TYPE_M68K(model) \ + { \ + .name =3D M68K_CPU_TYPE_NAME(#model), \ + .instance_init =3D model##_cpu_initfn, \ + .parent =3D TYPE_M68K_CPU, \ + .class_init =3D m68k_cpu_class_init_m68k_core \ } =20 static const TypeInfo m68k_cpus_type_infos[] =3D { @@ -314,15 +336,15 @@ static const TypeInfo m68k_cpus_type_infos[] =3D { .class_size =3D sizeof(M68kCPUClass), .class_init =3D m68k_cpu_class_init, }, - DEFINE_M68K_CPU_TYPE("m68000", m68000_cpu_initfn), - DEFINE_M68K_CPU_TYPE("m68020", m68020_cpu_initfn), - DEFINE_M68K_CPU_TYPE("m68030", m68030_cpu_initfn), - DEFINE_M68K_CPU_TYPE("m68040", m68040_cpu_initfn), - DEFINE_M68K_CPU_TYPE("m68060", m68060_cpu_initfn), - DEFINE_M68K_CPU_TYPE("m5206", m5206_cpu_initfn), - DEFINE_M68K_CPU_TYPE("m5208", m5208_cpu_initfn), - DEFINE_M68K_CPU_TYPE("cfv4e", cfv4e_cpu_initfn), - DEFINE_M68K_CPU_TYPE("any", any_cpu_initfn), + DEFINE_M68K_CPU_TYPE_M68K(m68000), + DEFINE_M68K_CPU_TYPE_M68K(m68020), + DEFINE_M68K_CPU_TYPE_M68K(m68030), + DEFINE_M68K_CPU_TYPE_M68K(m68040), + DEFINE_M68K_CPU_TYPE_M68K(m68060), + DEFINE_M68K_CPU_TYPE_CF(m5206), + DEFINE_M68K_CPU_TYPE_CF(m5208), + DEFINE_M68K_CPU_TYPE_CF(cfv4e), + DEFINE_M68K_CPU_TYPE_CF(any), }; =20 DEFINE_TYPES(m68k_cpus_type_infos) diff --git a/gdb-xml/m68k-core.xml b/gdb-xml/m68k-core.xml new file mode 100644 index 0000000000..5b092d26de --- /dev/null +++ b/gdb-xml/m68k-core.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.20.1