From patchwork Wed May 6 12:05:29 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: 186256 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp2053718ill; Wed, 6 May 2020 05:10:44 -0700 (PDT) X-Google-Smtp-Source: APiQypLyXMUP1JpAxP+/YN4WL+LXxfxuNiQ9nKrm1sD7x/XkcAR/5agfmHtxC9n9B3VgJQzjvVbl X-Received: by 2002:a37:4901:: with SMTP id w1mr7607120qka.181.1588767044124; Wed, 06 May 2020 05:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588767044; cv=none; d=google.com; s=arc-20160816; b=mWZfH0X08RkJ1AjdDqvgerSdCGuj2DOY/vgt9nmgnL3kOwMDgdg1SZqlMSuuaMmFWe dBCpIQey/udAPJCJ+dXoRWFdtN1ZysSzeLqay0lkcYq6w1yJ8gt0D+Bz2kSxSbhLdHtr AokuDDw3XBmo6K6xwPvv6vDnQMdABUIl2isgpAIX+QFfF67c/D/t0o+/AuWD3W0LOiJc iv10b2mwRLjncPyjNiLh1ixFQPAqAFBmJV84GMWqF8xLY8BIcXh70MVNTpAFQRVqRmlU Z5EQ3TPs47L5+S4Gf1L1NdbGJzR6f1hHv3zj+U72uLQzzRhB9rlGlX67Z2ZFSORXulzt 6tQA== 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=iiQCh//VFjxvmb6d7KKNLbr0lXh1jk7zOyRpXGAoAJ0=; b=bInsWUeZD6nSLBbIxCNJV67nb4Y1TGlZXoj4h01S5s/dgMGZIgLPfS8injEFmfjNSt R4Rw05Jxv6VACxKUKMuQyUMAX8duPATfpkVI8jzfkbvJHDYzAHCVbjsLu+dkk43R+SdQ pn7JZ7MJLbpRWKIxSWRaj/qyXFvdPQ6ZU9aS5MD4wE9DIWyezsy+e9cW/E63FhGk57D4 I7ofCoCnJx8R9dmeohoTaGBGjfS0QtQgN3vGAoJP/rLWytYVYkGuQyuHczehmYLMb+Sf 8rU3vmRR6Lhyc/zTMsRNsoBRHun4R4oxDUmpaVWISPGmXMXjuWVD/LZUdKU9celKx0As 66MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sdxmYPdd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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. [2001:470:142::17]) by mx.google.com with ESMTPS id b31si821144qtk.42.2020.05.06.05.10.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 May 2020 05:10:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::17 as permitted sender) client-ip=2001:470:142::17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=sdxmYPdd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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]:48732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWIst-00082l-K0 for patch@linaro.org; Wed, 06 May 2020 08:10:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWIoB-0006Rj-U2 for qemu-devel@nongnu.org; Wed, 06 May 2020 08:05:51 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:33713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jWIoA-0001Oq-J7 for qemu-devel@nongnu.org; Wed, 06 May 2020 08:05:51 -0400 Received: by mail-wr1-x434.google.com with SMTP id h9so1913738wrt.0 for ; Wed, 06 May 2020 05:05:50 -0700 (PDT) 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=iiQCh//VFjxvmb6d7KKNLbr0lXh1jk7zOyRpXGAoAJ0=; b=sdxmYPddTxb3LN2vOnBpgGedl2sxGR7QRuWnGYv669AaJNgKAUTU9Tye/YSMxkI3jm MzMrY7GwB8nNPBcWOaB2cji+Rzn234pGgGLIJh9G+Mz0y69KkgWj46Nxx8E9AFj7Vhso wAi1acVJoXYNmms2agbSzCui58hvu2gQtMR2VNVMfrOVQbisHb2gXA8JI0ABJEzeXnoU vfrRErCW1Dk+Xsuw4P5Th9utjhxaNWqFdZXGRxma0tqVP8D2zLdB68DVaWRPXPeF/gUf zWmdlMKgAIMKjPr5pfPC5bdrZL8gWatq3FVIhX7c7nBA41wwyiU0w8BJRqLSF/4hxP/0 EvVQ== 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=iiQCh//VFjxvmb6d7KKNLbr0lXh1jk7zOyRpXGAoAJ0=; b=hXeBv2x1EENaQ6MwhNGs+kn11PAUJBRbEUqbU7plo0wZjI2F+pp6zPoLJh/OysLZPG q8QexsJpP3/hXlTQ6qRRJdfSKqcxM7fzJ7tgO3wQ38sHT84mneb6LGIZU5k2xD+kQKoi t7E4aGi1MC7XnEJmU6amhMXMY8onUXVZzLqVvGRDwAaRRQXZHDoiEh5wZgom5GK06AMl rxovqX90mrNEVPII0DZ3hBhAFPNq5GX3QM65PdV7W5zVIOyQPi/C5FTiBrTR1RC4Boo1 TorpgfFBFgg4mzt47j0XhJlbr+zzb5/NMSgRwCsjhXgQa+0nGcj1d4SmONzU+U4ZypLY JrYg== X-Gm-Message-State: AGi0PuZP5qCA6q/LwoLeFCR/hUcM1q4HqT1Wnj927oMVvVoNmVdWUTiJ aQ71fN4Di+848GkJ/7qSl9lHMg== X-Received: by 2002:adf:ed82:: with SMTP id c2mr9822818wro.255.1588766749088; Wed, 06 May 2020 05:05:49 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u12sm2855904wmu.25.2020.05.06.05.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2020 05:05:46 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 063761FF9D; Wed, 6 May 2020 13:05:31 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 14/14] target/m68k: fix gdb for m68xxx Date: Wed, 6 May 2020 13:05:29 +0100 Message-Id: <20200506120529.18974-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200506120529.18974-1-alex.bennee@linaro.org> References: <20200506120529.18974-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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?= , Richard Henderson , qemu-devel@nongnu.org, Laurent Vivier , KONRAD Frederic , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 expects 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 = nan(0xffffffffffffffff) Signed-off-by: KONRAD Frederic Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Laurent Vivier Message-Id: <1588094279-17913-3-git-send-email-frederic.konrad@adacore.com> Message-Id: <20200430190122.4592-10-alex.bennee@linaro.org> -- 2.20.1 diff --git a/configure b/configure index c58787100f1..0d69c360c0e 100755 --- a/configure +++ b/configure @@ -7825,7 +7825,7 @@ case "$target_name" in ;; m68k) bflt="yes" - gdb_xml_files="cf-core.xml cf-fp.xml m68k-fp.xml" + gdb_xml_files="cf-core.xml cf-fp.xml m68k-core.xml m68k-fp.xml" TARGET_SYSTBL_ABI=common ;; microblaze|microblazeel) diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 9445fcd6df5..72c545149e9 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 = m68k_tcg_init; cc->gdb_num_core_regs = 18; - cc->gdb_core_xml_file = "cf-core.xml"; dc->vmsd = &vmstate_m68k_cpu; } -#define DEFINE_M68K_CPU_TYPE(cpu_model, initfn) \ - { \ - .name = M68K_CPU_TYPE_NAME(cpu_model), \ - .instance_init = initfn, \ - .parent = TYPE_M68K_CPU, \ +static void m68k_cpu_class_init_cf_core(ObjectClass *c, void *data) +{ + CPUClass *cc = CPU_CLASS(c); + + cc->gdb_core_xml_file = "cf-core.xml"; +} + +#define DEFINE_M68K_CPU_TYPE_CF(model) \ + { \ + .name = M68K_CPU_TYPE_NAME(#model), \ + .instance_init = model##_cpu_initfn, \ + .parent = TYPE_M68K_CPU, \ + .class_init = m68k_cpu_class_init_cf_core \ + } + +static void m68k_cpu_class_init_m68k_core(ObjectClass *c, void *data) +{ + CPUClass *cc = CPU_CLASS(c); + + cc->gdb_core_xml_file = "m68k-core.xml"; +} + +#define DEFINE_M68K_CPU_TYPE_M68K(model) \ + { \ + .name = M68K_CPU_TYPE_NAME(#model), \ + .instance_init = model##_cpu_initfn, \ + .parent = TYPE_M68K_CPU, \ + .class_init = m68k_cpu_class_init_m68k_core \ } static const TypeInfo m68k_cpus_type_infos[] = { @@ -314,15 +336,15 @@ static const TypeInfo m68k_cpus_type_infos[] = { .class_size = sizeof(M68kCPUClass), .class_init = 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), }; 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 00000000000..5b092d26de0 --- /dev/null +++ b/gdb-xml/m68k-core.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + +