From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23200 invoked by alias); 10 Nov 2010 02:21:42 -0000 Received: (qmail 23189 invoked by uid 22791); 10 Nov 2010 02:21:41 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Nov 2010 02:21:32 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id 5EDA12F78008 for ; Wed, 10 Nov 2010 02:21:29 +0000 (GMT) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oZD17JbTE6ly; Wed, 10 Nov 2010 02:21:27 +0000 (GMT) Message-ID: <4CDA01A4.8020606@eCosCentric.com> Date: Wed, 10 Nov 2010 02:21:00 -0000 From: Jonathan Larmour User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.10 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [patch] Add support for ARMv7M devices. References: <20100609140312.291855664EF@henry1.codesourcery.com> <4C101E0B.4040006@buzzard.freeserve.co.uk> <20100624164149.GD8410@caradoc.them.org> <4C23BA28.80106@buzzard.freeserve.co.uk> <20100816180525.GA13106@caradoc.them.org> <4CCB5CED.4030109@eCosCentric.com> <20101101033953.GA15714@caradoc.them.org> <4CD0D534.90701@eCosCentric.com> <20101103131734.GA5925@caradoc.them.org> In-Reply-To: <20101103131734.GA5925@caradoc.them.org> Content-Type: multipart/mixed; boundary="------------060108040800010502080203" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-11/txt/msg00142.txt.bz2 This is a multi-part message in MIME format. --------------060108040800010502080203 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1628 On 03/11/10 13:17, Daniel Jacobowitz wrote: > On Wed, Nov 03, 2010 at 03:21:24AM +0000, Jonathan Larmour wrote: >> I think there's a more general issue here about whether it's expected to >> maintain support for existing working stub implementations such that they >> can be used as they have been used even when GDB is upgraded. Changing the >> interface with GDB remote stubs used to be a big no-no for GDB. > > In general, I want to keep existing stubs working. But someone who > has access to an affected stub needs to lend a hand here; I don't and > can't test anything. I believe I've now worked out a solution, and it's not that complicated in fact. See the attached patch. The key seems to be to let remote.c choose the tdesc. 2010-11-09 Jonathan Larmour * arm-tdep.c (arm_gdbarch_init): Allow M-profile targets' remote stubs to provide 'g' packets with or without FPA registers. > With stubs out there sending both FPA-regs+fake-CPSR and > FPA-regs+XPSR, I don't know how to make it work; in fact, I don't know > how FPA-regs+XPSR ever worked. It's clearly impossible to tell the difference between fake-CPSR and XPSR. But even an XML target description can't make that case work right, so I don't think that's too bad for us not to cope with. Unless you have some ideas (a 'set' option seems overkill). Jifl -- eCosCentric Limited http://www.eCosCentric.com/ The eCos experts Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571 Registered in England and Wales: Reg No 4422071. ------["Si fractum non sit, noli id reficere"]------ Opinions==mine --------------060108040800010502080203 Content-Type: text/plain; name="mprofile-backcompat.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mprofile-backcompat.patch" Content-length: 5878 diff -x CVS -x .svn -x '*~' -x '.#*' -x autom4te.cache -urpN src.old/gdb/arm-tdep.c src/gdb/arm-tdep.c --- src.old/gdb/arm-tdep.c 2010-11-10 01:25:08.000000000 +0000 +++ src/gdb/arm-tdep.c 2010-11-10 02:00:31.000000000 +0000 @@ -42,6 +42,7 @@ #include "prologue-value.h" #include "target-descriptions.h" #include "user-regs.h" +#include "remote.h" #include "arm-tdep.h" #include "gdb/sim-arm.h" @@ -54,6 +55,7 @@ #include "vec.h" #include "features/arm-with-m.c" +#include "features/arm-with-m-fpa.c" static int arm_debug; @@ -7130,7 +7132,7 @@ arm_gdbarch_init (struct gdbarch_info in && (attr_arch == TAG_CPU_ARCH_V6_M || attr_arch == TAG_CPU_ARCH_V6S_M || attr_profile == 'M')) - tdesc = tdesc_arm_with_m; + is_m = 1; #endif } @@ -7192,6 +7194,8 @@ arm_gdbarch_init (struct gdbarch_info in else is_m = 1; } + else + is_m = 0; tdesc_data = tdesc_data_alloc (); @@ -7566,6 +7570,29 @@ arm_gdbarch_init (struct gdbarch_info in user_reg_add (gdbarch, arm_register_aliases[i].name, value_of_arm_user_reg, &arm_register_aliases[i].regnum); + if (is_m) + { + /* For backward-compatibility we allow two 'g' packet lengths with + the remote protocol depending on whether FPA registers are + supplied. M-profile targets do not have FPA registers, but some + stubs already exist in the wild which use a 'g' packet which + supplies them albeit with dummy values. The packet format which + includes FPA registers should be considered deprecated for + M-profile targets. + + The register sizes are fixed for these target descriptions in the + XML files, so we can hard-code them: r0-12,sp,lr,pc,xpsr for + tdesc_arm_with_m; and additionally f0-f7 and fps for + tdesc_arm_with_m_fpa. */ + + register_remote_g_packet_guess (gdbarch, + 17 * INT_REGISTER_SIZE, + tdesc_arm_with_m); + register_remote_g_packet_guess (gdbarch, + 18 * INT_REGISTER_SIZE + + 8 * FP_REGISTER_SIZE, + tdesc_arm_with_m_fpa); + } return gdbarch; } @@ -7609,6 +7636,7 @@ _initialize_arm_tdep (void) /* Initialize the standard target descriptions. */ initialize_tdesc_arm_with_m (); + initialize_tdesc_arm_with_m_fpa (); /* Get the number of possible sets of register names defined in opcodes. */ num_disassembly_options = get_arm_regname_num_options (); diff -x CVS -x .svn -x '*~' -x '.#*' -x autom4te.cache -urpN src.old/gdb/features/arm-with-m-fpa.c src/gdb/features/arm-with-m-fpa.c --- src.old/gdb/features/arm-with-m-fpa.c 1970-01-01 01:00:00.000000000 +0100 +++ src/gdb/features/arm-with-m-fpa.c 2010-11-10 02:00:31.000000000 +0000 @@ -0,0 +1,46 @@ +/* THIS FILE IS GENERATED. Original: arm-with-m-fpa.xml */ + +#include "defs.h" +#include "osabi.h" +#include "target-descriptions.h" + +struct target_desc *tdesc_arm_with_m_fpa; +static void +initialize_tdesc_arm_with_m_fpa (void) +{ + struct target_desc *result = allocate_target_description (); + struct tdesc_feature *feature; + struct tdesc_type *field_type, *type; + + feature = tdesc_create_feature (result, "org.gnu.gdb.arm.m-profile"); + tdesc_create_reg (feature, "r0", 0, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r1", 1, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r2", 2, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r3", 3, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r4", 4, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r5", 5, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r6", 6, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r7", 7, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r8", 8, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r9", 9, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r10", 10, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r11", 11, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "r12", 12, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "sp", 13, 1, NULL, 32, "data_ptr"); + tdesc_create_reg (feature, "lr", 14, 1, NULL, 32, "int"); + tdesc_create_reg (feature, "pc", 15, 1, NULL, 32, "code_ptr"); + tdesc_create_reg (feature, "xpsr", 25, 1, NULL, 32, "int"); + + feature = tdesc_create_feature (result, "org.gnu.gdb.arm.fpa"); + tdesc_create_reg (feature, "f0", 16, 1, NULL, 96, "arm_fpa_ext"); + tdesc_create_reg (feature, "f1", 17, 1, NULL, 96, "arm_fpa_ext"); + tdesc_create_reg (feature, "f2", 18, 1, NULL, 96, "arm_fpa_ext"); + tdesc_create_reg (feature, "f3", 19, 1, NULL, 96, "arm_fpa_ext"); + tdesc_create_reg (feature, "f4", 20, 1, NULL, 96, "arm_fpa_ext"); + tdesc_create_reg (feature, "f5", 21, 1, NULL, 96, "arm_fpa_ext"); + tdesc_create_reg (feature, "f6", 22, 1, NULL, 96, "arm_fpa_ext"); + tdesc_create_reg (feature, "f7", 23, 1, NULL, 96, "arm_fpa_ext"); + tdesc_create_reg (feature, "fps", 24, 1, NULL, 32, "int"); + + tdesc_arm_with_m_fpa = result; +} diff -x CVS -x .svn -x '*~' -x '.#*' -x autom4te.cache -urpN src.old/gdb/features/arm-with-m-fpa.xml src/gdb/features/arm-with-m-fpa.xml --- src.old/gdb/features/arm-with-m-fpa.xml 1970-01-01 01:00:00.000000000 +0100 +++ src/gdb/features/arm-with-m-fpa.xml 2010-11-10 02:00:31.000000000 +0000 @@ -0,0 +1,12 @@ + + + + + + + + --------------060108040800010502080203--