From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19482 invoked by alias); 5 Jun 2012 17:03:31 -0000 Received: (qmail 19473 invoked by uid 22791); 5 Jun 2012 17:03:27 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO,SARE_SUB_OBFU_Q1,TW_BJ X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Jun 2012 17:03:14 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 740B11C6E0A; Tue, 5 Jun 2012 13:03:13 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Sb3wInltq+9k; Tue, 5 Jun 2012 13:03:13 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id D43551C6E04; Tue, 5 Jun 2012 13:03:12 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 49613145616; Tue, 5 Jun 2012 10:03:05 -0700 (PDT) Date: Tue, 05 Jun 2012 17:03:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Pedro Alves Subject: [RFC] Add xmlRegisters qSupported on ppc-lynx... Message-ID: <20120605170305.GA25948@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="XsQoSWH+UP9D9v3l" Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2012-06/txt/msg00134.txt.bz2 --XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1785 Hi Pedro, I was wondering if you good give some feedback on something I am trying to do. Basically, I am working on gdbserver for powerpc-lynx178. Version 178 of LynxOS is based on an older version of LynxOS where XCOFF is still in use. The object format is actually identical to the one used on AIX. The problem is that GDB and GDBserver use different register numberings. On the target side, the register number is the same as the ones we see on versions 4.x and 5.x. But on the GDB side, because the objfect format is the same as on AIX, the architecture ends up being set to "rs6000:6000" (instead of "powerpc:common"). As a result, there are a few discrepancies in terms of a couple of registers ("fpscr" is the one that attracted my attention). So, my idea was to have GDBserver tell GDB what the number is. Unlike what I am seeing on x86 targets, I don't think we need anything fancy because, for now, the register map is completely static. So we don't need to configure the register map besides setting it at initialization (init_registers_powerpc_32). The first thing I did was update rs6000-tdep.c so that GDB would ask for xmlRegister support. And to my surprise, that was almost enough to get things working. All I had to do next was to update configure.tgt to include the appropriate XML files, and things started working. I thought I would have to confirm support for xmlRegister first, but it looks like it's not the case. Can you tell me what you think of the following patch? Am I going to need to do something a little more elaborate, for instance? I am also worrying about breaking other power targets, but I hope not. Hopefully GDB sends a qXfer:features:read:target.xml packet, gets an error, and falls back to the default architecture... Thanks! -- Joel --XsQoSWH+UP9D9v3l Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-gdbserver-lynx-ppc-xml.diff" Content-length: 1399 diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index d037c8e..fd26caf 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -230,6 +230,9 @@ case "${target}" in ;; powerpc-*-lynxos*) srv_regobj="powerpc-32.o" srv_tgtobj="lynx-low.o lynx-ppc-low.o" + srv_xmlfiles="rs6000/powerpc-32.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/power-core.xml" + srv_xmlfiles="${srv_xmlfiles} rs6000/power-fpu.xml" srv_lynxos=yes ;; s390*-*-linux*) srv_regobj="s390-linux32.o" diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index f848700..2252f54 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -79,6 +79,7 @@ #include "features/rs6000/powerpc-860.c" #include "features/rs6000/powerpc-e500.c" #include "features/rs6000/rs6000.c" +#include "remote.h" /* Determine if regnum is an SPE pseudo-register. */ #define IS_SPE_PSEUDOREG(tdep, regnum) ((tdep)->ppc_ev0_regnum >= 0 \ @@ -4284,6 +4285,9 @@ _initialize_rs6000_tdep (void) initialize_tdesc_powerpc_e500 (); initialize_tdesc_rs6000 (); + /* Tell remote stub that we support XML target description. */ + register_remote_support_xml ("powerpc"); + /* Add root prefix command for all "set powerpc"/"show powerpc" commands. */ add_prefix_cmd ("powerpc", no_class, set_powerpc_command, --XsQoSWH+UP9D9v3l--