This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Add xmlRegisters qSupported on ppc-lynx...


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
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,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]