Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl3/gdb/dist/gdb Provide regset functions and gut ...
details: https://anonhg.NetBSD.org/src/rev/1342085d536b
branches: trunk
changeset: 769913:1342085d536b
user: christos <christos%NetBSD.org@localhost>
date: Mon Sep 26 20:38:54 2011 +0000
description:
Provide regset functions and gut parts that the new debugging thread library
does not provide yet, so that we can link. As expected this does not work
yet.
diffstat:
external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c | 50 ++++++++++++
external/gpl3/gdb/dist/gdb/nbsd-thread.c | 119 ++++++++++++++--------------
2 files changed, 111 insertions(+), 58 deletions(-)
diffs (truncated from 513 to 300 lines):
diff -r 9520562b3c05 -r 1342085d536b external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c
--- a/external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c Mon Sep 26 19:02:39 2011 +0000
+++ b/external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c Mon Sep 26 20:38:54 2011 +0000
@@ -32,6 +32,17 @@
#include <machine/frame.h>
#include <machine/pcb.h>
+#include <machine/reg.h>
+
+#ifndef HAVE_GREGSET_T
+typedef struct reg gregset_t;
+#endif
+
+#ifndef HAVE_FPREGSET_T
+typedef struct fpreg fpregset_t;
+#endif
+
+#include "gregset.h"
/* Mapping between the general-purpose registers in NetBSD/amd64
`struct reg' format and GDB's register cache layout for
@@ -113,6 +124,45 @@
return 1;
}
+void
+supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
+{
+ amd64_supply_native_gregset (regcache, gregsetp, -1);
+}
+
+/* Fill register REGNUM (if it is a general-purpose register) in
+ *GREGSETP with the value in GDB's register cache. If REGNUM is -1,
+ do this for all registers. */
+
+void
+fill_gregset (const struct regcache *regcache,
+ gregset_t *gregsetp, int regnum)
+{
+ amd64_collect_native_gregset (regcache, gregsetp, regnum);
+}
+
+/* Transfering floating-point registers between GDB, inferiors and cores. */
+
+/* Fill GDB's register cache with the floating-point and SSE register
+ values in *FPREGSETP. */
+
+void
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
+{
+ amd64_supply_fxsave (regcache, -1, fpregsetp);
+}
+
+/* Fill register REGNUM (if it is a floating-point or SSE register) in
+ *FPREGSETP with the value in GDB's register cache. If REGNUM is
+ -1, do this for all registers. */
+
+void
+fill_fpregset (const struct regcache *regcache,
+ fpregset_t *fpregsetp, int regnum)
+{
+ amd64_collect_fxsave (regcache, regnum, fpregsetp);
+}
+
/* Provide a prototype to silence -Wmissing-prototypes. */
void _initialize_amd64nbsd_nat (void);
diff -r 9520562b3c05 -r 1342085d536b external/gpl3/gdb/dist/gdb/nbsd-thread.c
--- a/external/gpl3/gdb/dist/gdb/nbsd-thread.c Mon Sep 26 19:02:39 2011 +0000
+++ b/external/gpl3/gdb/dist/gdb/nbsd-thread.c Mon Sep 26 20:38:54 2011 +0000
@@ -75,14 +75,6 @@
struct td_proc_callbacks_t nbsd_thread_callbacks;
struct td_proc_callbacks_t nbsd_core_callbacks;
-/* place to store core_ops before we overwrite it */
-static struct target_ops orig_core_ops;
-
-extern struct target_ops child_ops; /* target vector for inftarg.c */
-extern struct target_ops core_ops; /* target vector for corelow.c */
-
-extern int child_suppress_run;
-
static ptid_t find_active_thread (void);
static void nbsd_find_new_threads (struct target_ops *);
@@ -169,12 +161,13 @@
static void
nbsd_thread_attach (struct target_ops *ops, char *args, int from_tty)
{
+ struct target_ops *beneath = find_target_beneath (ops);
nbsd_thread_core = 0;
if (nbsd_thread_present && !nbsd_thread_active)
push_target(&nbsd_thread_ops);
- child_ops.to_attach (ops, args, from_tty);
+ beneath->to_attach (beneath, args, from_tty);
/* seems like a good place to activate, but isn't. Let it happen in
nbsd_thread_post_attach(), after a wait has occurred. */
@@ -183,7 +176,10 @@
static void
nbsd_thread_post_attach (int pid)
{
- child_ops.to_post_attach (pid);
+#if 0
+ struct target_ops *beneath = find_target_beneath (ops);
+ beneath->to_post_attach (pid);
+#endif
if (nbsd_thread_present && !nbsd_thread_active)
nbsd_thread_activate ();
@@ -209,7 +205,7 @@
cache so that attach -> detach -> attach works. */
clear_solib();
symbol_file_clear(0);
- child_ops.to_detach (beneath, args, from_tty);
+ beneath->to_detach (beneath, args, from_tty);
}
static int nsusp;
@@ -266,6 +262,7 @@
nbsd_thread_resume (struct target_ops *ops, ptid_t ptid, int step,
enum target_signal signo)
{
+ struct target_ops *beneath = find_target_beneath (ops);
/* If a particular thread is specified, then gdb wants to resume or
step just that thread. If it isn't on a processor, then it needs
@@ -282,12 +279,12 @@
if (val != 0)
error ("nbsd_thread_resume td_thr_iter: %s", td_err_string (val));
- child_ops.to_resume (ops, ptid, step, signo);
+ beneath->to_resume (beneath, ptid, step, signo);
/* can't un-suspend just yet, child may not be stopped */
}
else
- child_ops.to_resume (ops, ptid, step, signo);
+ beneath->to_resume (beneath, ptid, step, signo);
cached_thread = minus_one_ptid;
}
@@ -341,8 +338,9 @@
struct target_waitstatus *ourstatus, int options)
{
ptid_t rtnval;
+ struct target_ops *beneath = find_target_beneath (ops);
- rtnval = child_ops.to_wait (ops, ptid, ourstatus, options);
+ rtnval = beneath->to_wait (beneath, ptid, ourstatus, options);
nbsd_thread_unsuspend();
@@ -362,6 +360,7 @@
nbsd_thread_fetch_registers (struct target_ops *ops, struct regcache *cache,
int regno)
{
+ struct target_ops *beneath = find_target_beneath (ops);
td_thread_t *thread;
gregset_t gregs;
fpregset_t fpregs;
@@ -384,14 +383,12 @@
}
else
{
- if (target_has_execution)
- child_ops.to_fetch_registers (ops, cache, regno);
- else
+ if (!target_has_execution)
{
inferior_ptid = pid_to_ptid ((GET_LWP (inferior_ptid) << 16) |
GET_PID (inferior_ptid));
- orig_core_ops.to_fetch_registers (ops, cache, regno);
}
+ beneath->to_fetch_registers (beneath, cache, regno);
}
do_cleanups (old_chain);
@@ -401,6 +398,7 @@
nbsd_thread_store_registers (struct target_ops *ops, struct regcache *cache,
int regno)
{
+ struct target_ops *beneath = find_target_beneath (ops);
td_thread_t *thread;
gregset_t gregs;
fpregset_t fpregs;
@@ -427,10 +425,7 @@
}
else
{
- if (target_has_execution)
- child_ops.to_store_registers (ops, cache, regno);
- else
- orig_core_ops.to_store_registers (ops, cache, regno);
+ beneath->to_store_registers (beneath, cache, regno);
}
}
@@ -443,15 +438,11 @@
const gdb_byte *writebuf, ULONGEST offset,
LONGEST len)
{
+ struct target_ops *beneath = find_target_beneath (ops);
LONGEST val;
- if (target_has_execution)
- val = child_ops.to_xfer_partial (ops, object, annex, readbuf, writebuf,
- offset, len);
- else
- val = orig_core_ops.to_xfer_partial (ops, object, annex, readbuf, writebuf,
- offset, len);
-
+ val = beneath->to_xfer_partial (beneath, object, annex, readbuf, writebuf,
+ offset, len);
return val;
}
@@ -466,20 +457,22 @@
nbsd_thread_deactivate ();
unpush_target (ops);
- child_ops.to_mourn_inferior (beneath);
+ beneath->to_mourn_inferior (beneath);
}
static void
nbsd_thread_files_info (struct target_ops *ignore)
{
- child_ops.to_files_info (ignore);
+ struct target_ops *beneath = find_target_beneath (ignore);
+ beneath->to_files_info (beneath);
}
static void
nbsd_core_files_info (struct target_ops *ignore)
{
- orig_core_ops.to_files_info (ignore);
+ struct target_ops *beneath = find_target_beneath (ignore);
+ beneath->to_files_info (beneath);
}
/* Convert a ptid to printable form. */
@@ -531,10 +524,6 @@
goto quit;
}
- /* don't do anything if init failed */
- if (!child_suppress_run)
- goto quit;
-
/* Don't do anything if we've already fired up the debugging library */
if (nbsd_thread_active)
goto quit;
@@ -566,6 +555,7 @@
static int
nbsd_thread_alive (struct target_ops *ops, ptid_t ptid)
{
+ struct target_ops *beneath = find_target_beneath (ops);
td_thread_t *th;
td_thread_info_t ti;
int val;
@@ -595,10 +585,10 @@
val = 1;
}
else
- val = child_ops.to_thread_alive (ops, ptid);
+ val = beneath->to_thread_alive (beneath, ptid);
}
else
- val = child_ops.to_thread_alive (ops, ptid);
+ val = beneath->to_thread_alive (beneath, ptid);
return val;
}
@@ -606,7 +596,8 @@
static int
nbsd_core_thread_alive (struct target_ops *ops, ptid_t ptid)
{
- return orig_core_ops.to_thread_alive (ops, ptid);
+ struct target_ops *beneath = find_target_beneath (ops);
+ return beneath->to_thread_alive (beneath, ptid);
}
@@ -638,15 +629,13 @@
{
int retval;
ptid_t ptid;
+#ifdef notyet
td_thread_t *thread;
+#endif
if (nbsd_thread_active == 0)
return;
- /* don't do anything if init failed to resolve the libthread_db library */
- if (!child_suppress_run)
Home |
Main Index |
Thread Index |
Old Index