aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2006-05-05 22:39:12 +0000
committerDavid S. Miller <davem@redhat.com>2006-05-05 22:39:12 +0000
commit4f844a660e65ffa5481c4ad2d844caca16d35790 (patch)
tree8955fece9e9e16192b074aefc39e924837cfe217 /gdb
parent411cb3f932370f4e2707a12cae9c14130afae328 (diff)
downloadgdb-4f844a660e65ffa5481c4ad2d844caca16d35790.zip
gdb-4f844a660e65ffa5481c4ad2d844caca16d35790.tar.gz
gdb-4f844a660e65ffa5481c4ad2d844caca16d35790.tar.bz2
* linux-nat.c (linux_nat_do_thread_registers): Use the
regset_from_core_section infrastructure if the target supports it. * Makefile.in: Update dependencies.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/Makefile.in4
-rw-r--r--gdb/linux-nat.c82
3 files changed, 74 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 590e8d9..b5e6667 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2006-05-05 David S. Miller <davem@sunset.davemloft.net>
+
+ * linux-nat.c (linux_nat_do_thread_registers): Use the
+ regset_from_core_section infrastructure if the target
+ supports it.
+ * Makefile.in: Update dependencies.
+
2006-05-05: Paul Gilliam <pgilliam@us.ibm.com>
* ppc-linux-nat.c: Clean up types for ptrace.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index e27a718..a8b58a1 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -2198,8 +2198,8 @@ linux-fork.o: linux-fork.c $(defs_h) $(inferior_h) $(regcache_h) $(gdbcmd_h) \
$(linux_nat_h)
linux-nat.o: linux-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdb_string_h) \
$(gdb_wait_h) $(gdb_assert_h) $(linux_nat_h) $(gdbthread_h) \
- $(gdbcmd_h) $(regcache_h) $(inf_ptrace_h) $(auxv_h) $(elf_bfd_h) \
- $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(gdb_stat_h) \
+ $(gdbcmd_h) $(regcache_h) $(regset_h) $(inf_ptrace_h) $(auxv_h) \
+ $(elf_bfd_h) $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(gdb_stat_h) \
$(linux_fork_h)
linux-thread-db.o: linux-thread-db.c $(defs_h) $(gdb_assert_h) \
$(gdb_proc_service_h) $(gdb_thread_db_h) $(bfd_h) $(exceptions_h) \
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index f050e7e..31e46d6 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -36,6 +36,7 @@
#include "gdbthread.h"
#include "gdbcmd.h"
#include "regcache.h"
+#include "regset.h"
#include "inf-ptrace.h"
#include "auxv.h"
#include <sys/param.h> /* for MAXPATHLEN */
@@ -2535,25 +2536,72 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
gdb_fpxregset_t fpxregs;
#endif
unsigned long lwp = ptid_get_lwp (ptid);
+ struct gdbarch *gdbarch = current_gdbarch;
+ const struct regset *regset;
+ int core_regset_p, record_reg_p;
+
+ core_regset_p = gdbarch_regset_from_core_section_p (gdbarch);
+ record_reg_p = 1;
+ if (core_regset_p)
+ {
+ regset = gdbarch_regset_from_core_section (gdbarch, ".reg",
+ sizeof (gregs));
+ if (regset)
+ regset->collect_regset (regset, current_regcache, -1,
+ &gregs, sizeof (gregs));
+ else
+ record_reg_p = 0;
+ }
+ else
+ fill_gregset (&gregs, -1);
+
+ if (record_reg_p)
+ note_data = (char *) elfcore_write_prstatus (obfd,
+ note_data,
+ note_size,
+ lwp,
+ stop_signal, &gregs);
+
+ record_reg_p = 1;
+ if (core_regset_p)
+ {
+ regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
+ sizeof (fpregs));
+ if (regset)
+ regset->collect_regset (regset, current_regcache, -1,
+ &fpregs, sizeof (fpregs));
+ else
+ record_reg_p = 0;
+ }
+ else
+ fill_fpregset (&fpregs, -1);
+
+ if (record_reg_p)
+ note_data = (char *) elfcore_write_prfpreg (obfd,
+ note_data,
+ note_size,
+ &fpregs, sizeof (fpregs));
- fill_gregset (&gregs, -1);
- note_data = (char *) elfcore_write_prstatus (obfd,
- note_data,
- note_size,
- lwp,
- stop_signal, &gregs);
-
- fill_fpregset (&fpregs, -1);
- note_data = (char *) elfcore_write_prfpreg (obfd,
- note_data,
- note_size,
- &fpregs, sizeof (fpregs));
#ifdef FILL_FPXREGSET
- fill_fpxregset (&fpxregs, -1);
- note_data = (char *) elfcore_write_prxfpreg (obfd,
- note_data,
- note_size,
- &fpxregs, sizeof (fpxregs));
+ record_reg_p = 1;
+ if (core_regset_p)
+ {
+ regset = gdbarch_regset_from_core_section (gdbarch, ".reg-xfp",
+ sizeof (fpxregs));
+ if (regset)
+ regset->collect_regset (regset, current_regcache, -1,
+ &fpxregs, sizeof (fpxregs));
+ else
+ record_reg_p = 0;
+ }
+ else
+ fill_fpxregset (&fpxregs, -1);
+
+ if (record_reg_p)
+ note_data = (char *) elfcore_write_prxfpreg (obfd,
+ note_data,
+ note_size,
+ &fpxregs, sizeof (fpxregs));
#endif
return note_data;
}