Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com
Subject: [rfa/ppc/branch too] Fix PowerPC/Linux cores
Date: Mon, 30 Jul 2001 14:23:00 -0000	[thread overview]
Message-ID: <20010730142328.A6323@nevyn.them.org> (raw)

I figure it would be nice if core files for Linux/PPC worked on the branch. 
Linux/PPC doesn't have gregset_t or fpregset_t in its headers, so the body
of fetch_core_registers in core-regset.c gets #if'd out by autoconf.  Cores
load but are absolutely useless.  I have the feeling those #if's ought to be
outside the function rather than inside... but in any case, for now, this
patch fixes it the same way most other Linux targets do.  I'll get back to
my rework of core support in the next few weeks now that we've branched.

OK to commit, trunk and branch?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer



2001-07-30  Daniel Jacobowitz  <drow@mvista.com>

	* config/powerpc/linux.mh (NATDEPFILES): Remove core-regset.o.
	* ppc-linux-nat.c (fetch_core_registers): New function.
	(regset_core_fns): New structure.
	(_initialize_ppc_linux_nat): New function.

Index: config/powerpc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/linux.mh,v
retrieving revision 1.6
diff -u -r1.6 linux.mh
--- gdb/gdb/config/powerpc/linux.mh	2000/10/30 22:33:32	1.6
+++ gdb/gdb/config/powerpc/linux.mh	2001/07/30 19:30:59
@@ -6,7 +6,7 @@
 
 NAT_FILE= nm-linux.h
 NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
-core-aout.o core-regset.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o
+core-aout.o ppc-linux-nat.o proc-service.o thread-db.o lin-lwp.o
 
 LOADLIBES = -ldl -rdynamic
 
Index: ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.9
diff -u -r1.9 ppc-linux-nat.c
--- gdb/gdb/ppc-linux-nat.c	2001/07/05 23:22:04	1.9
+++ gdb/gdb/ppc-linux-nat.c	2001/07/30 19:44:38
@@ -126,3 +126,57 @@
         }
     }
 }
+
+/*  Use a local version of this function to get the correct types for
+    regsets, until multi-arch core support is ready.  */
+
+static void
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+		      int which, CORE_ADDR reg_addr)
+{
+  elf_gregset_t gregset;
+  elf_fpregset_t fpregset;
+
+  if (which == 0)
+    {
+      if (core_reg_size != sizeof (gregset))
+	{
+	  warning ("wrong size gregset struct in core file");
+	}
+      else
+	{
+	  memcpy ((char *) &gregset, core_reg_sect, sizeof (gregset));
+	  supply_gregset (&gregset);
+	}
+    }
+  else if (which == 2)
+    {
+      if (core_reg_size != sizeof (fpregset))
+	{
+	  warning ("wrong size fpregset struct in core file");
+	}
+      else
+	{
+	  memcpy ((char *) &fpregset, core_reg_sect, sizeof (fpregset));
+	  supply_fpregset (&fpregset);
+	}
+    }
+}
+
+/* Register that we are able to handle ELF file formats using standard
+   procfs "regset" structures.  */
+
+static struct core_fns regset_core_fns =
+{
+  bfd_target_elf_flavour,		/* core_flavour */
+  default_check_format,			/* check_format */
+  default_core_sniffer,			/* core_sniffer */
+  fetch_core_registers,			/* core_read_registers */
+  NULL					/* next */
+};
+
+void
+_initialize_ppc_linux_nat (void)
+{
+  add_core_fns (&regset_core_fns);
+}


             reply	other threads:[~2001-07-30 14:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-30 14:23 Daniel Jacobowitz [this message]
2001-07-30 15:44 ` Kevin Buettner
2001-07-30 15:54   ` Daniel Jacobowitz
2001-07-30 17:50     ` Kevin Buettner
2001-07-30 17:57       ` Daniel Jacobowitz
2001-07-31  8:50         ` Andrew Cagney
2001-08-02 12:08       ` Daniel Jacobowitz
2001-08-02 12:48         ` Kevin Buettner
2001-08-03  8:39           ` Andrew Cagney
2001-08-03 14:36             ` Daniel Jacobowitz

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=20010730142328.A6323@nevyn.them.org \
    --to=drow@mvista.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