Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Martin Gadbois <martin.gadbois@colubris.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Cross target core debugging: host=i386, Target=PPC
Date: Mon, 29 Jul 2002 14:06:00 -0000	[thread overview]
Message-ID: <3D45ACCC.9040803@colubris.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's the result of the mailing list posting http://sources.redhat.com/ml/gdb/2002-05/msg00191.html
applied for PPC.
Apply patch against GDB 5.2, and you'll be able to debug core dumps on a Intel host from a PowerPC
target.

The OS for both is Linux.

PS: Please reply to me directly, as I am not a member of this list.

- --
==============
Martin Gadbois
S/W Developper
Colubris Networks Inc.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAj1FrMwACgkQ9Y3/iTTCEDnPJwCfYF9zY+QXN31wPM5dMQh2+cfX
Zx8AoKBo3dVSqRQx2en0gZUoJea/OhNI
=nrPR
-----END PGP SIGNATURE-----

[-- Attachment #2: gdb-5.2-ppc-cross-core.patch --]
[-- Type: text/plain, Size: 4311 bytes --]

diff -Naur gdb-5.2/gdb/config/powerpc/linux.mt gdb-5.2-ppc-core/gdb/config/powerpc/linux.mt
--- gdb-5.2/gdb/config/powerpc/linux.mt	Fri Oct 19 20:16:44 2001
+++ gdb-5.2-ppc-core/gdb/config/powerpc/linux.mt	Mon Jul 29 16:25:49 2002
@@ -1,5 +1,5 @@
 # Target: Motorola PPC on Linux
-TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o solib-legacy.o
+TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o solib-legacy.o corelow.o core-regset.o
 TM_FILE= tm-linux.h
 
 SIM_OBS = remote-sim.o
diff -Naur gdb-5.2/gdb/core-regset.c gdb-5.2-ppc-core/gdb/core-regset.c
--- gdb-5.2/gdb/core-regset.c	Fri Aug  3 17:34:01 2001
+++ gdb-5.2-ppc-core/gdb/core-regset.c	Mon Jul 29 15:45:28 2002
@@ -35,13 +35,6 @@
  */
 
 #include "defs.h"
-
-#include <time.h>
-#ifdef HAVE_SYS_PROCFS_H
-#include <sys/procfs.h>
-#endif
-#include <fcntl.h>
-#include <errno.h>
 #include "gdb_string.h"
 
 #include "inferior.h"
diff -Naur gdb-5.2/gdb/gregset.h gdb-5.2-ppc-core/gdb/gregset.h
--- gdb-5.2/gdb/gregset.h	Sun Feb 24 17:14:33 2002
+++ gdb-5.2-ppc-core/gdb/gregset.h	Mon Jul 29 15:45:43 2002
@@ -21,6 +21,20 @@
 #ifndef GREGSET_H
 #define GREGSET_H
 
+
+#define ELF_NGREG	48	/* includes nip, msr, lr, etc. */
+#define ELF_NFPREG	33	/* includes fpscr */
+#define ELF_NVRREG	33	/* includes vscr */
+
+typedef unsigned long elf_greg_t;
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+typedef double elf_fpreg_t;
+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
+
+#define GDB_GREGSET_T elf_gregset_t
+#define GDB_FPREGSET_T elf_fpregset_t
+
 #ifndef GDB_GREGSET_T
 #define GDB_GREGSET_T gregset_t
 #endif
diff -Naur gdb-5.2/gdb/ppc-linux-tdep.c gdb-5.2-ppc-core/gdb/ppc-linux-tdep.c
--- gdb-5.2/gdb/ppc-linux-tdep.c	Sun Feb 24 17:31:19 2002
+++ gdb-5.2-ppc-core/gdb/ppc-linux-tdep.c	Mon Jul 29 14:59:24 2002
@@ -35,6 +35,7 @@
 #include "solib-svr4.h"
 #include "ppc-tdep.h"
 
+#include "gregset.h"
 /* The following two instructions are used in the signal trampoline
    code on GNU/Linux PPC.  */
 #define INSTR_LI_R0_0x7777	0x38007777
@@ -101,7 +102,61 @@
 #define PPC_LINUX_PT_FPR31 (PPC_LINUX_PT_FPR0 + 2*31)
 #define PPC_LINUX_PT_FPSCR (PPC_LINUX_PT_FPR0 + 2*32 + 1)
 
+#define FP0_REGNUM 32		/* FPR (Floating point) register 0 */
 static int ppc_linux_at_sigtramp_return_path (CORE_ADDR pc);
+
+#define SIZEOF_VRREGS 33*16+4
+typedef char gdb_vrregset_t[SIZEOF_VRREGS];
+
+
+static void
+supply_vrregset (gdb_vrregset_t *vrregsetp)
+{
+  int i;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+  int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1;
+  int vrregsize = REGISTER_RAW_SIZE (tdep->ppc_vr0_regnum);
+  int offset = vrregsize - REGISTER_RAW_SIZE (tdep->ppc_vrsave_regnum);
+
+  for (i = 0; i < num_of_vrregs; i++)
+    {
+      /* The last 2 registers of this set are only 32 bit long, not
+         128.  However an offset is necessary only for VSCR because it
+         occupies a whole vector, while VRSAVE occupies a full 4 bytes
+         slot.  */
+      if (i == (num_of_vrregs - 2))
+        supply_register (tdep->ppc_vr0_regnum + i,
+                         *vrregsetp + i * vrregsize + offset);
+      else
+        supply_register (tdep->ppc_vr0_regnum + i, *vrregsetp + i * vrregsize);
+    }
+}
+void
+supply_gregset (gdb_gregset_t *gregsetp)
+{
+  int regi;
+  register elf_greg_t *regp = (elf_greg_t *) gregsetp;
+  struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); 
+
+  for (regi = 0; regi < 32; regi++)
+    supply_register (regi, (char *) (regp + regi));
+
+  supply_register (PC_REGNUM, (char *) (regp + PPC_LINUX_PT_NIP));
+  supply_register (tdep->ppc_lr_regnum, (char *) (regp + PPC_LINUX_PT_LNK));
+  supply_register (tdep->ppc_cr_regnum, (char *) (regp + PPC_LINUX_PT_CCR));
+  supply_register (tdep->ppc_xer_regnum, (char *) (regp + PPC_LINUX_PT_XER));
+  supply_register (tdep->ppc_ctr_regnum, (char *) (regp + PPC_LINUX_PT_CTR));
+  supply_register (tdep->ppc_mq_regnum, (char *) (regp + PPC_LINUX_PT_MQ));
+  supply_register (tdep->ppc_ps_regnum, (char *) (regp + PPC_LINUX_PT_MSR));
+}
+void
+supply_fpregset (gdb_fpregset_t * fpregsetp)
+{
+  int regi;
+
+  for (regi = 0; regi < 32; regi++)
+    supply_register (FP0_REGNUM + regi, (char *) (*fpregsetp + regi));
+}
 
 /* Determine if pc is in a signal trampoline...
 



             reply	other threads:[~2002-07-29 21:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-29 14:06 Martin Gadbois [this message]
2002-07-29 14:59 ` Kevin Buettner
2002-07-29 16:45   ` Jason R Thorpe
2002-07-29 18:50     ` Daniel Jacobowitz
2002-07-30  8:35       ` Daniel Jacobowitz
2002-07-30  8:50         ` Martin Gadbois
2002-07-30 12:09           ` Daniel Jacobowitz
2002-07-30 10:47         ` Kevin Buettner
2002-07-30 10:52           ` Martin Gadbois
2002-07-30 11:24             ` Kevin Buettner
2002-07-30 10:55           ` Daniel Jacobowitz
2002-07-30 12:05           ` Daniel Jacobowitz
2002-07-30  5:53   ` Martin Gadbois
2002-07-30  6:43   ` Martin Gadbois
2002-07-29 15:07 ` Kevin Buettner
2002-07-30  5:30   ` Martin Gadbois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D45ACCC.9040803@colubris.com \
    --to=martin.gadbois@colubris.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox