This is the mail archive of the gdb-patches@sources.redhat.com 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]

[PATCH] Use regset-based core file support for fbsd-proc.c


Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* fbsd-proc.c: Include "regcache.h", "regset.h" and
	"gdb_assert.h".  Con't include "gregset.h".
	(fbsd_make_corefile_notes): Use regset-based core file support
	instead off fill_gregset and fill_fpregset.
	* Makefile.in (fbsd-proc.o): Update dependencies.

Index: fbsd-proc.c
===================================================================
RCS file: /cvs/src/src/gdb/fbsd-proc.c,v
retrieving revision 1.7
diff -u -p -r1.7 fbsd-proc.c
--- fbsd-proc.c 7 Nov 2003 16:30:26 -0000 1.7
+++ fbsd-proc.c 30 May 2004 18:27:05 -0000
@@ -22,15 +22,16 @@
 #include "defs.h"
 #include "gdbcore.h"
 #include "inferior.h"
-#include "gdb_string.h"
+#include "regcache.h"
+#include "regset.h"
 
+#include "gdb_assert.h"
+#include "gdb_string.h"
 #include <sys/procfs.h>
 #include <sys/types.h>
 
 #include "elf-bfd.h"
 
-#include "gregset.h"
-
 char *
 child_pid_to_exec_file (int pid)
 {
@@ -120,21 +121,35 @@ fbsd_find_memory_regions (int (*func) (C
 static char *
 fbsd_make_corefile_notes (bfd *obfd, int *note_size)
 {
+  struct gdbarch *gdbarch = current_gdbarch;
+  const struct regcache *regcache = current_regcache;
   gregset_t gregs;
   fpregset_t fpregs;
   char *note_data = NULL;
   Elf_Internal_Ehdr *i_ehdrp;
+  const struct regset *regset;
+  size_t size;
 
   /* Put a "FreeBSD" label in the ELF header.  */
   i_ehdrp = elf_elfheader (obfd);
   i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_FREEBSD;
 
-  fill_gregset (&gregs, -1);
+  gdb_assert (gdbarch_regset_from_core_section_p (gdbarch));
+
+  size = sizeof gregs;
+  regset = gdbarch_regset_from_core_section (gdbarch, ".reg", size);
+  gdb_assert (regset && regset->collect_regset);
+  regset->collect_regset (regset, regcache, -1, &gregs, size);
+
   note_data = elfcore_write_prstatus (obfd, note_data, note_size,
 				      ptid_get_pid (inferior_ptid),
 				      stop_signal, &gregs);
 
-  fill_fpregset (&fpregs, -1);
+  size = sizeof fpregs;
+  regset = gdbarch_regset_from_core_section (gdbarch, ".reg2", size);
+  gdb_assert (regset && regset->collect_regset);
+  regset->collect_regset (regset, regcache, -1, &fpregs, size);
+
   note_data = elfcore_write_prfpreg (obfd, note_data, note_size,
 				     &fpregs, sizeof (fpregs));
 
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.581
diff -u -p -r1.581 Makefile.in
--- Makefile.in 26 May 2004 05:31:39 -0000 1.581
+++ Makefile.in 30 May 2004 18:27:07 -0000
@@ -1760,7 +1760,8 @@ expprint.o: expprint.c $(defs_h) $(symta
 	$(value_h) $(language_h) $(parser_defs_h) $(user_regs_h) $(target_h) \
 	$(gdb_string_h) $(block_h)
 fbsd-proc.o: fbsd-proc.c $(defs_h) $(gdbcore_h) $(inferior_h) \
-	$(gdb_string_h) $(elf_bfd_h) $(gregset_h)
+	$(regcache_h) $(regset_h) $(gdb_assert_h) $(gdb_string_h) \
+	$(elf_bfd_h)
 f-exp.o: f-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(value_h) \
 	$(parser_defs_h) $(language_h) $(f_lang_h) $(bfd_h) $(symfile_h) \
 	$(objfiles_h) $(block_h)


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