* [RFC] GDB patches for hw watchpoints
@ 2005-08-17 18:30 Manoj Iyer
2005-08-17 18:46 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Manoj Iyer @ 2005-08-17 18:30 UTC (permalink / raw)
To: gdb-patches
I am submitting this patch on behalf of Ben Elliston <bje@au1.ibm.com>,
this patch implements hardware watchpoints on PPC platform. Please review
and comment, so I can commit.
2005-05-04 Ben Elliston <bje@au.ibm.com>
* config/powerpc/nm-linux.h
(HAVE_NONSTEPPABLE_WATCHPOINT): Define.
(TARGET_REGION_OK_FOR_HW_WATCHPOINT): Likewise.
(TARGET_CAN_USE_HARDWARE_WATCHPOINT): Likewise.
(STOPPED_BY_WATCHPOINT): Likewise.
(target_insert_watchpoint): Likewise.
(target_remove_watchpoint): Likewise.
(ppc_linux_insert_watchpoint): Declare.
(ppc_linux_remove_watchpoint): Likewise.
* ppc-linux-nat.c (PTRACE_GET_DEBUGREG): Define, if not already.
(PTRACE_SET_DEBUGREG): Likewise.
(PTRACE_GETSINGOINFO): Likewise.
(ppc_linux_insert_watchpoint): New.
(ppc_linux_remove_watchpoint): Likewise.
(ppc_linux_stopped_by_watchpoint): Likewise.
(ppc_linux_check_watch_resources): Likewise.
Index: config/powerpc/nm-linux.h
===================================================================
RCS file: /home/bje/src-cvs/src/gdb/config/powerpc/nm-linux.h,v
retrieving revision 1.12
diff -u -p -r1.12 nm-linux.h
--- config/powerpc/nm-linux.h 29 Jul 2004 20:22:50 -0000 1.12
+++ config/powerpc/nm-linux.h 16 Aug 2005 01:53:56 -0000
@@ -34,4 +34,26 @@ extern int kernel_u_size (void);
#define FETCH_INFERIOR_REGISTERS
+/* Hardware watchpoints */
+
+#define HAVE_NONSTEPPABLE_WATCHPOINT 1
+#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) 1
+
+#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
+ ppc_linux_check_watch_resources (type, cnt, ot)
+
+#define STOPPED_BY_WATCHPOINT(w) \
+ ppc_linux_stopped_by_watchpoint (w)
+
+#define target_insert_watchpoint(addr, len, type) \
+ ppc_linux_insert_watchpoint (inferior_ptid, addr, len, type)
+#define target_remove_watchpoint(addr, len, type) \
+ ppc_linux_remove_watchpoint (inferior_ptid, addr, len)
+
+extern long ppc_linux_insert_watchpoint (ptid_t ptid, CORE_ADDR addr,
+ int len, int rw);
+
+extern long ppc_linux_remove_watchpoint (ptid_t ptid, CORE_ADDR addr,
+ int len);
+
#endif /* #ifndef NM_LINUX_H */Index: ppc-linux-nat.c
===================================================================
RCS file: /home/bje/src-cvs/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.54
diff -u -p -r1.54 ppc-linux-nat.c
--- ppc-linux-nat.c 11 Feb 2005 18:13:51 -0000 1.54
+++ ppc-linux-nat.c 16 Aug 2005 01:53:56 -0000
@@ -79,6 +79,16 @@
#define PTRACE_SETEVRREGS 21
#endif
+/* Similarly for the hardware watchpoint support. */
+#ifndef PTRACE_GET_DEBUGREG
+#define PTRACE_GET_DEBUGREG 25
+#endif
+#ifndef PTRACE_SET_DEBUGREG
+#define PTRACE_SET_DEBUGREG 26
+#endif
+#ifndef PTRACE_GETSIGINFO
+#define PTRACE_GETSIGINFO 0x4202
+#endif
/* This oddity is because the Linux kernel defines elf_vrregset_t as
an array of 33 16 bytes long elements. I.e. it leaves out vrsave.
@@ -883,3 +893,82 @@ fill_fpregset (gdb_fpregset_t *fpregsetp
right_fill_reg (tdep->ppc_fpscr_regnum, (fpp + 8 * 32));
}
}
+
+/* Set a watchpoint of type TYPE at address ADDR. */
+long
+ppc_linux_insert_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rw)
+{
+ int tid;
+ long dabr_value;
+
+ /* Handle sub-8-byte quantities. */
+ if (len <= 0)
+ return -1;
+
+ /* addr+len must fall in the 8 byte watchable region. */
+ if ((addr + len) > (addr & ~7) + 8)
+ return -1;
+
+ dabr_value = addr & ~7;
+ switch (rw)
+ {
+ case hw_read:
+ /* Set read and translate bits. */
+ dabr_value |= 5;
+ break;
+ case hw_write:
+ /* Set write and translate bits. */
+ dabr_value |= 6;
+ break;
+ case hw_access:
+ /* Set read, write and translate bits. */
+ dabr_value |= 7;
+ break;
+ }
+
+ tid = TIDGET (ptid);
+ if (tid == 0)
+ tid = PIDGET (ptid);
+
+ return ptrace (PTRACE_SET_DEBUGREG, tid, 0, dabr_value);
+}
+
+long
+ppc_linux_remove_watchpoint (ptid_t ptid, CORE_ADDR addr, int len)
+{
+ int tid;
+
+ tid = TIDGET (ptid);
+ if (tid == 0)
+ tid = PIDGET (ptid);
+
+ return ptrace (PTRACE_SET_DEBUGREG, tid, 0, 0);
+}
+
+int
+ppc_linux_stopped_by_watchpoint (void)
+{
+ int tid;
+ struct siginfo siginfo;
+ ptid_t ptid = inferior_ptid;
+
+ tid = TIDGET(ptid);
+ if (tid == 0)
+ tid = PIDGET (ptid);
+
+ errno = 0;
+ ptrace (PTRACE_GETSIGINFO, tid, (PTRACE_TYPE_ARG3) 0, &siginfo);
+
+ if (errno != 0 || siginfo.si_signo != SIGTRAP ||
+ (siginfo.si_code & 0xffff) != 0x0004)
+ return 0;
+
+ return 1;
+}
+
+int
+ppc_linux_check_watch_resources (int type, int cnt, int ot)
+{
+ /* PPC has one DABR (hardware watchpoint) register. */
+ return (cnt <= 1);
+}
----------
Manoj Iyer
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Cogito ergo sum +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC] GDB patches for hw watchpoints
2005-08-17 18:30 [RFC] GDB patches for hw watchpoints Manoj Iyer
@ 2005-08-17 18:46 ` Eli Zaretskii
2005-08-17 23:03 ` Mark Kettenis
2005-09-18 1:20 ` [RFC] GDB patches for hw watchpoints Daniel Jacobowitz
2 siblings, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2005-08-17 18:46 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb-patches
> Date: Wed, 17 Aug 2005 12:27:46 -0500 (CDT)
> From: Manoj Iyer <manjo@austin.ibm.com>
>
>
> I am submitting this patch on behalf of Ben Elliston <bje@au1.ibm.com>,
> this patch implements hardware watchpoints on PPC platform. Please review
> and comment, so I can commit.
This is fine with me, but do I understand correctly that the PPC
doesn't have a way to return the data address that triggered the
watchpoint? If so, how do things work on a PPC when GDB calls
target_stopped_data_address? What am I missing?
Also, please add an entry in NEWS about this.
Last, but not least, thanks for working on this!
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC] GDB patches for hw watchpoints
2005-08-17 18:30 [RFC] GDB patches for hw watchpoints Manoj Iyer
2005-08-17 18:46 ` Eli Zaretskii
@ 2005-08-17 23:03 ` Mark Kettenis
2005-08-19 0:53 ` [RFC/RFA] Target vectors for native Linux targets Ulrich Weigand
2005-09-18 1:20 ` [RFC] GDB patches for hw watchpoints Daniel Jacobowitz
2 siblings, 1 reply; 14+ messages in thread
From: Mark Kettenis @ 2005-08-17 23:03 UTC (permalink / raw)
To: manjo; +Cc: gdb-patches
> Date: Wed, 17 Aug 2005 12:27:46 -0500 (CDT)
> From: Manoj Iyer <manjo@austin.ibm.com>
>
> I am submitting this patch on behalf of Ben Elliston <bje@au1.ibm.com>,
> this patch implements hardware watchpoints on PPC platform. Please review
> and comment, so I can commit.
Sorry, but you're not supposed to add anything to nm.h files anymore.
Instead you should add things to the target vector. Take a look at
inf-ttrace.c on how to do this.
This may be hard to do at the moment, since the target vector stuff
for native Linux targets is a bit of a mess. That really needs to be
fixed!
Mark
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFC/RFA] Target vectors for native Linux targets
2005-08-17 23:03 ` Mark Kettenis
@ 2005-08-19 0:53 ` Ulrich Weigand
2005-08-21 10:48 ` Mark Kettenis
2005-09-04 22:48 ` Daniel Jacobowitz
0 siblings, 2 replies; 14+ messages in thread
From: Ulrich Weigand @ 2005-08-19 0:53 UTC (permalink / raw)
To: Mark Kettenis; +Cc: manjo, gdb-patches
Mark Kettenis wrote:
> Sorry, but you're not supposed to add anything to nm.h files anymore.
> Instead you should add things to the target vector. Take a look at
> inf-ttrace.c on how to do this.
>
> This may be hard to do at the moment, since the target vector stuff
> for native Linux targets is a bit of a mess. That really needs to be
> fixed!
Some time ago I attempted to do this, but never got around to submitting
the patches. This looks like a good opportunity to resurrect them ...
One problem with the conversion is that I wouldn't want to have to
convert all the various Linux subtargets at the same time. It's a
lot of work, and I'm unable to test most of those platforms. Thus
I've thought of a way to stage the conversion:
- First, linux-nat.c is changed to support either the old-style target
(overriding deprecated_child_ops entries) or new-style targets
implemented via a linux_target () routine. The new style is selected
by defining USE_LINUX_TARGET in the nm file.
The patch in this mail implements this step.
- Then, Linux subtargets can be converted one by one to use the new style.
I'd hope the various maintainers would take on their platforms.
In a subsequent mail I'll send a patch implementing this step for s390.
- Once all targets have been converted, the remains of old-style support
(and USE_LINUX_TARGET) are removed frome linux-nat.c.
The patch below implements the first step. By itself, it shouldn't change
the behaviour at all. The changes are relatively mechanical; in particular
the way the miscellaneous thread and process stratum target layers are
related to each other isn't changed at all -- the new style simply uses
a target generated by linux_target () instead of deprecated_child_ops
as process stratum.
To avoid calling child_xfer_memory I had to switch to using xfer_partial
instead. This change also bubbled up to linux-thread-db.c. (But seeing
as xfer_memory is deprecated, that's probably a good idea anyway.)
What do you think of this approach?
This patch was tested on s390x-ibm-linux without regressions.
Bye,
Ulrich
ChangeLog:
* Makefile (linux-nat.o): Depend on $(inf_ptrace.h) and $(auxv_h).
* linux-nat.c: Include "inf_prtrace.h" and "auxv.h".
(linux_ops): New global variable.
(child_follow_fork): Use it instead of deprecated_child_ops.
(linux_nat_attach, linux_nat_detach): Likewise.
(resume_callback, linux_nat_resume): Likewise.
(linux_nat_create_inferior, linux_nat_mourn_inferior): Likewise.
(linux_nat_wait): Use linux_ops->to_resume instead of child_resume.
(child_wait): Do not depend on CHILD_WAIT.
(linux_nat_xfer_memory): Remove, replace by ...
(linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial
instead of child_xfer_memory.
(linux_nat_fetch_registers, linux_nat_store_registers): New functions.
(init_linux_nat_ops): Use them instead of fetch_inferior_register
and store_inferior_registers. Set to_xfer_partial instead of
deprecated_xfer_memory.
(linux_proc_xfer_memory): Remove, replace by ...
(linux_proc_xfer_partial): ... this. Make static.
(inf_ptrace_xfer_partial): New global variable.
(linux_xfer_partial): New function.
(linux_target): New function.
(_initialize_linux_nat): If USE_LINUX_TARGET, do not modify
deprecated_child_ops.
* linux-nat.h (linux_proc_xfer_memory): Remove prototype.
(struct mem_attrib, struct target_ops): Remove forward declarations.
(linux_target): Add prototype.
* linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ...
(thread_db_xfer_partial): ... this.
(init_thread_db_ops): Set to_xfer_partial instead of
deprecated_xfer_memory.
* config/nm-linux.h (struct target_waitstatus, child_wait, CHILD_WAIT,
CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT,
CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT,
CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK,
DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV, #include "auxv.h"):
Remove unless USE_LINUX_TARGET.
Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.742
diff -c -p -r1.742 Makefile.in
*** gdb/Makefile.in 8 Aug 2005 20:59:18 -0000 1.742
--- gdb/Makefile.in 18 Aug 2005 23:45:50 -0000
*************** linespec.o: linespec.c $(defs_h) $(symta
*** 2174,2181 ****
$(objc_lang_h) $(linespec_h) $(exceptions_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) $(elf_bfd_h) $(gregset_h) $(gdbcore_h) \
! $(gdbthread_h) $(gdb_stat_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) \
$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \
--- 2174,2181 ----
$(objc_lang_h) $(linespec_h) $(exceptions_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)
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) \
$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \
Index: gdb/linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.31
diff -c -p -r1.31 linux-nat.c
*** gdb/linux-nat.c 9 Aug 2005 16:35:45 -0000 1.31
--- gdb/linux-nat.c 18 Aug 2005 23:45:50 -0000
***************
*** 34,39 ****
--- 34,41 ----
#include "gdbthread.h"
#include "gdbcmd.h"
#include "regcache.h"
+ #include "inf-ptrace.h"
+ #include "auxv.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <sys/procfs.h> /* for elf_gregset etc. */
#include "elf-bfd.h" /* for elfcore_write_* */
***************
*** 81,86 ****
--- 83,96 ----
#define __WALL 0x40000000 /* Wait for any child. */
#endif
+ /* FIXME: All USE_LINUX_TARGET ifdefs can be removed once all GNU/Linux
+ targets have been modified to use linux_target. */
+ #ifndef USE_LINUX_TARGET
+ static struct target_ops *linux_ops = &deprecated_child_ops;
+ #else
+ static struct target_ops *linux_ops;
+ #endif
+
static int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
*************** child_follow_fork (int follow_child)
*** 466,472 ****
target_detach (NULL, 0);
inferior_ptid = pid_to_ptid (child_pid);
! push_target (&deprecated_child_ops);
/* Reset breakpoints in the child as appropriate. */
follow_inferior_reset_breakpoints ();
--- 476,482 ----
target_detach (NULL, 0);
inferior_ptid = pid_to_ptid (child_pid);
! push_target (linux_ops);
/* Reset breakpoints in the child as appropriate. */
follow_inferior_reset_breakpoints ();
*************** linux_nat_attach (char *args, int from_t
*** 910,916 ****
/* FIXME: We should probably accept a list of process id's, and
attach all of them. */
! deprecated_child_ops.to_attach (args, from_tty);
/* Add the initial process as the first LWP to the list. */
lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)));
--- 920,926 ----
/* FIXME: We should probably accept a list of process id's, and
attach all of them. */
! linux_ops->to_attach (args, from_tty);
/* Add the initial process as the first LWP to the list. */
lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)));
*************** linux_nat_detach (char *args, int from_t
*** 1020,1026 ****
sigemptyset (&blocked_mask);
inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
! deprecated_child_ops.to_detach (args, from_tty);
}
/* Resume LP. */
--- 1030,1036 ----
sigemptyset (&blocked_mask);
inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
! linux_ops->to_detach (args, from_tty);
}
/* Resume LP. */
*************** resume_callback (struct lwp_info *lp, vo
*** 1032,1038 ****
{
struct thread_info *tp;
! child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n",
--- 1042,1049 ----
{
struct thread_info *tp;
! linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
! 0, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n",
*************** linux_nat_resume (ptid_t ptid, int step,
*** 1106,1112 ****
if (resume_all)
iterate_over_lwps (resume_callback, NULL);
! child_resume (ptid, step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLR: %s %s, %s (resume event thread)\n",
--- 1117,1123 ----
if (resume_all)
iterate_over_lwps (resume_callback, NULL);
! linux_ops->to_resume (ptid, step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLR: %s %s, %s (resume event thread)\n",
*************** resumed_callback (struct lwp_info *lp, v
*** 1680,1687 ****
return lp->resumed;
}
- #ifdef CHILD_WAIT
-
/* We need to override child_wait to support attaching to cloned
processes, since a normal wait (as done by the default version)
ignores those processes. */
--- 1691,1696 ----
*************** child_wait (ptid_t ptid, struct target_w
*** 1786,1793 ****
return pid_to_ptid (pid);
}
- #endif
-
/* Stop an active thread, verify it still exists, then resume it. */
static int
--- 1795,1800 ----
*************** retry:
*** 1896,1903 ****
/* Resume the thread. It should halt immediately returning the
pending SIGSTOP. */
registers_changed ();
! child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
! TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
--- 1903,1910 ----
/* Resume the thread. It should halt immediately returning the
pending SIGSTOP. */
registers_changed ();
! linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
! lp->step, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
*************** retry:
*** 2098,2105 ****
lp->signalled = 0;
registers_changed ();
! child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
! TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
--- 2105,2112 ----
lp->signalled = 0;
registers_changed ();
! linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
! lp->step, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
*************** retry:
*** 2158,2164 ****
newly attached threads may cause an unwanted delay in
getting them running. */
registers_changed ();
! child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, %s (preempt 'handle')\n",
--- 2165,2172 ----
newly attached threads may cause an unwanted delay in
getting them running. */
registers_changed ();
! linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
! lp->step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, %s (preempt 'handle')\n",
*************** static void
*** 2307,2313 ****
linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
int from_tty)
{
! deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
}
static void
--- 2315,2321 ----
linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
int from_tty)
{
! linux_ops->to_create_inferior (exec_file, allargs, env, from_tty);
}
static void
*************** linux_nat_mourn_inferior (void)
*** 2322,2345 ****
sigprocmask (SIG_SETMASK, &normal_mask, NULL);
sigemptyset (&blocked_mask);
! deprecated_child_ops.to_mourn_inferior ();
}
! static int
! linux_nat_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
! int write, struct mem_attrib *attrib,
! struct target_ops *target)
{
struct cleanup *old_chain = save_inferior_ptid ();
! int xfer;
if (is_lwp (inferior_ptid))
inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
! xfer = linux_proc_xfer_memory (memaddr, myaddr, len, write, attrib, target);
if (xfer == 0)
! xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target);
!
do_cleanups (old_chain);
return xfer;
}
--- 2330,2360 ----
sigprocmask (SIG_SETMASK, &normal_mask, NULL);
sigemptyset (&blocked_mask);
! linux_ops->to_mourn_inferior ();
}
! static LONGEST
! linux_proc_xfer_partial (struct target_ops *ops, enum target_object object,
! const char *annex, gdb_byte *readbuf,
! const gdb_byte *writebuf,
! ULONGEST offset, LONGEST len);
! static LONGEST
! linux_nat_xfer_partial (struct target_ops *ops, enum target_object object,
! const char *annex, gdb_byte *readbuf,
! const gdb_byte *writebuf,
! ULONGEST offset, LONGEST len)
{
struct cleanup *old_chain = save_inferior_ptid ();
! LONGEST xfer;
if (is_lwp (inferior_ptid))
inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
! xfer = linux_proc_xfer_partial (ops, object, annex,
! readbuf, writebuf, offset, len);
if (xfer == 0)
! xfer = linux_ops->to_xfer_partial (ops, object, annex,
! readbuf, writebuf, offset, len);
do_cleanups (old_chain);
return xfer;
}
*************** linux_nat_pid_to_str (ptid_t ptid)
*** 2377,2382 ****
--- 2392,2409 ----
}
static void
+ linux_nat_fetch_registers (int regnum)
+ {
+ linux_ops->to_fetch_registers (regnum);
+ }
+
+ static void
+ linux_nat_store_registers (int regnum)
+ {
+ linux_ops->to_store_registers (regnum);
+ }
+
+ static void
init_linux_nat_ops (void)
{
#if 0
*************** init_linux_nat_ops (void)
*** 2389,2399 ****
linux_nat_ops.to_detach = linux_nat_detach;
linux_nat_ops.to_resume = linux_nat_resume;
linux_nat_ops.to_wait = linux_nat_wait;
! /* fetch_inferior_registers and store_inferior_registers will
! honor the LWP id, so we can use them directly. */
! linux_nat_ops.to_fetch_registers = fetch_inferior_registers;
! linux_nat_ops.to_store_registers = store_inferior_registers;
! linux_nat_ops.deprecated_xfer_memory = linux_nat_xfer_memory;
linux_nat_ops.to_kill = linux_nat_kill;
linux_nat_ops.to_create_inferior = linux_nat_create_inferior;
linux_nat_ops.to_mourn_inferior = linux_nat_mourn_inferior;
--- 2416,2424 ----
linux_nat_ops.to_detach = linux_nat_detach;
linux_nat_ops.to_resume = linux_nat_resume;
linux_nat_ops.to_wait = linux_nat_wait;
! linux_nat_ops.to_fetch_registers = linux_nat_fetch_registers;
! linux_nat_ops.to_store_registers = linux_nat_store_registers;
! linux_nat_ops.to_xfer_partial = linux_nat_xfer_partial;
linux_nat_ops.to_kill = linux_nat_kill;
linux_nat_ops.to_create_inferior = linux_nat_create_inferior;
linux_nat_ops.to_mourn_inferior = linux_nat_mourn_inferior;
*************** linux_nat_info_proc_cmd (char *args, int
*** 2945,2958 ****
}
}
! int
! linux_proc_xfer_memory (CORE_ADDR addr, gdb_byte *myaddr, int len, int write,
! struct mem_attrib *attrib, struct target_ops *target)
{
! int fd, ret;
char filename[64];
! if (write)
return 0;
/* Don't bother for one word. */
--- 2970,2986 ----
}
}
! static LONGEST
! linux_proc_xfer_partial (struct target_ops *ops, enum target_object object,
! const char *annex, gdb_byte *readbuf,
! const gdb_byte *writebuf,
! ULONGEST offset, LONGEST len)
{
! LONGEST ret;
! int fd;
char filename[64];
! if (object != TARGET_OBJECT_MEMORY || !readbuf)
return 0;
/* Don't bother for one word. */
*************** linux_proc_xfer_memory (CORE_ADDR addr,
*** 2971,2979 ****
32-bit platforms (for instance, SPARC debugging a SPARC64
application). */
#ifdef HAVE_PREAD64
! if (pread64 (fd, myaddr, len, addr) != len)
#else
! if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
#endif
ret = 0;
else
--- 2999,3007 ----
32-bit platforms (for instance, SPARC debugging a SPARC64
application). */
#ifdef HAVE_PREAD64
! if (pread64 (fd, readbuf, len, offset) != len)
#else
! if (lseek (fd, offset, SEEK_SET) == -1 || read (fd, readbuf, len) != len)
#endif
ret = 0;
else
*************** linux_proc_pending_signals (int pid, sig
*** 3064,3077 ****
--- 3092,3154 ----
fclose (procfile);
}
+ #ifdef USE_LINUX_TARGET
+ LONGEST (*inf_ptrace_xfer_partial) (struct target_ops *, enum target_object,
+ const char *, gdb_byte *, const gdb_byte *,
+ ULONGEST, LONGEST);
+
+ static LONGEST
+ linux_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
+ {
+ if (object == TARGET_OBJECT_AUXV)
+ return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
+ offset, len);
+
+ return inf_ptrace_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+ }
+
+ /* Create a prototype generic Linux target. The client can override
+ it with local methods. */
+
+ struct target_ops *
+ linux_target (void)
+ {
+ struct target_ops *t;
+
+ t = inf_ptrace_target ();
+ t->to_wait = child_wait;
+ t->to_kill = kill_inferior;
+ t->to_insert_fork_catchpoint = child_insert_fork_catchpoint;
+ t->to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
+ t->to_insert_exec_catchpoint = child_insert_exec_catchpoint;
+ t->to_pid_to_exec_file = child_pid_to_exec_file;
+ t->to_post_startup_inferior = child_post_startup_inferior;
+ t->to_post_attach = child_post_attach;
+ t->to_follow_fork = child_follow_fork;
+ t->to_find_memory_regions = linux_nat_find_memory_regions;
+ t->to_make_corefile_notes = linux_nat_make_corefile_notes;
+
+ inf_ptrace_xfer_partial = t->to_xfer_partial;
+ t->to_xfer_partial = linux_xfer_partial;
+
+ linux_ops = t;
+ return t;
+ }
+ #endif /* USE_LINUX_TARGET */
+
void
_initialize_linux_nat (void)
{
struct sigaction action;
extern void thread_db_init (struct target_ops *);
+ #ifndef USE_LINUX_TARGET
deprecated_child_ops.to_find_memory_regions = linux_nat_find_memory_regions;
deprecated_child_ops.to_make_corefile_notes = linux_nat_make_corefile_notes;
+ #endif
add_info ("proc", linux_nat_info_proc_cmd, _("\
Show /proc process information about any running process.\n\
Index: gdb/linux-nat.h
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.h,v
retrieving revision 1.7
diff -c -p -r1.7 linux-nat.h
*** gdb/linux-nat.h 9 Aug 2005 16:35:45 -0000 1.7
--- gdb/linux-nat.h 18 Aug 2005 23:45:50 -0000
*************** struct lwp_info
*** 63,76 ****
struct lwp_info *next;
};
- /* Read/write to target memory via the Linux kernel's "proc file
- system". */
- struct mem_attrib;
- struct target_ops;
-
- extern int linux_proc_xfer_memory (CORE_ADDR addr, gdb_byte *myaddr, int len,
- int write, struct mem_attrib *attrib,
- struct target_ops *target);
/* Find process PID's pending signal set from /proc/pid/status. */
void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored);
--- 63,68 ----
*************** extern void linux_child_post_startup_inf
*** 86,88 ****
--- 78,86 ----
struct lwp_info *iterate_over_lwps (int (*callback) (struct lwp_info *,
void *),
void *data);
+
+
+ /* Create a prototype generic Linux target. The client can override
+ it with local methods. */
+ struct target_ops * linux_target (void);
+
Index: gdb/linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.9
diff -c -p -r1.9 linux-thread-db.c
*** gdb/linux-thread-db.c 28 May 2005 16:44:29 -0000 1.9
--- gdb/linux-thread-db.c 18 Aug 2005 23:45:50 -0000
*************** thread_db_wait (ptid_t ptid, struct targ
*** 961,972 ****
return ptid;
}
! static int
! thread_db_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
! struct mem_attrib *attrib, struct target_ops *target)
{
struct cleanup *old_chain = save_inferior_ptid ();
! int xfer;
if (is_thread (inferior_ptid))
{
--- 961,973 ----
return ptid;
}
! static LONGEST
! thread_db_xfer_partial (struct target_ops *ops, enum target_object object,
! const char *annex, gdb_byte *readbuf,
! const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
struct cleanup *old_chain = save_inferior_ptid ();
! LONGEST xfer;
if (is_thread (inferior_ptid))
{
*************** thread_db_xfer_memory (CORE_ADDR memaddr
*** 978,986 ****
inferior_ptid = lwp_from_thread (inferior_ptid);
}
! xfer =
! target_beneath->deprecated_xfer_memory (memaddr, myaddr, len, write,
! attrib, target);
do_cleanups (old_chain);
return xfer;
--- 979,986 ----
inferior_ptid = lwp_from_thread (inferior_ptid);
}
! xfer = target_beneath->to_xfer_partial (ops, object, annex,
! readbuf, writebuf, offset, len);
do_cleanups (old_chain);
return xfer;
*************** init_thread_db_ops (void)
*** 1298,1304 ****
thread_db_ops.to_wait = thread_db_wait;
thread_db_ops.to_fetch_registers = thread_db_fetch_registers;
thread_db_ops.to_store_registers = thread_db_store_registers;
! thread_db_ops.deprecated_xfer_memory = thread_db_xfer_memory;
thread_db_ops.to_kill = thread_db_kill;
thread_db_ops.to_create_inferior = thread_db_create_inferior;
thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior;
--- 1298,1304 ----
thread_db_ops.to_wait = thread_db_wait;
thread_db_ops.to_fetch_registers = thread_db_fetch_registers;
thread_db_ops.to_store_registers = thread_db_store_registers;
! thread_db_ops.to_xfer_partial = thread_db_xfer_partial;
thread_db_ops.to_kill = thread_db_kill;
thread_db_ops.to_create_inferior = thread_db_create_inferior;
thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior;
Index: gdb/config/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
retrieving revision 1.24
diff -c -p -r1.24 nm-linux.h
*** gdb/config/nm-linux.h 20 Sep 2004 16:39:34 -0000 1.24
--- gdb/config/nm-linux.h 18 Aug 2005 23:45:51 -0000
*************** struct target_ops;
*** 42,52 ****
#endif
\f
- /* Override child_wait in `inftarg.c'. */
- struct target_waitstatus;
- extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
- #define CHILD_WAIT
-
extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
--- 42,47 ----
*************** extern void lin_thread_get_thread_signal
*** 59,64 ****
--- 54,70 ----
#define GDB_GREGSET_T elf_gregset_t
#define GDB_FPREGSET_T elf_fpregset_t
+
+ /* FIXME: Everything below here can be deleted once all GNU/Linux
+ targets have been modified to use linux_target. */
+
+ #ifndef USE_LINUX_TARGET
+
+ /* Override child_wait in `inftarg.c'. */
+ struct target_waitstatus;
+ extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
+ #define CHILD_WAIT
+
/* Override child_pid_to_exec_file in 'inftarg.c'. */
#define CHILD_PID_TO_EXEC_FILE
*************** extern void lin_thread_get_thread_signal
*** 72,74 ****
--- 78,83 ----
#define NATIVE_XFER_AUXV procfs_xfer_auxv
#include "auxv.h" /* Declares it. */
+
+ #endif /* USE_LINUX_TARGET */
+
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC/RFA] Target vectors for native Linux targets
2005-08-19 0:53 ` [RFC/RFA] Target vectors for native Linux targets Ulrich Weigand
@ 2005-08-21 10:48 ` Mark Kettenis
2005-08-21 15:21 ` Ulrich Weigand
2005-09-04 22:48 ` Daniel Jacobowitz
1 sibling, 1 reply; 14+ messages in thread
From: Mark Kettenis @ 2005-08-21 10:48 UTC (permalink / raw)
To: uweigand; +Cc: manjo, gdb-patches
> From: Ulrich Weigand <uweigand@de.ibm.com>
> Date: Fri, 19 Aug 2005 02:51:24 +0200 (CEST)
>
> Mark Kettenis wrote:
>
> > Sorry, but you're not supposed to add anything to nm.h files anymore.
> > Instead you should add things to the target vector. Take a look at
> > inf-ttrace.c on how to do this.
> >
> > This may be hard to do at the moment, since the target vector stuff
> > for native Linux targets is a bit of a mess. That really needs to be
> > fixed!
>
> Some time ago I attempted to do this, but never got around to submitting
> the patches. This looks like a good opportunity to resurrect them ...
>
> One problem with the conversion is that I wouldn't want to have to
> convert all the various Linux subtargets at the same time. It's a
> lot of work, and I'm unable to test most of those platforms.
Yeah, that's a general problem. These days, there doesn't seem to be
anyone who feels responsible for gdb on more than one or two different
Linux platforms.
> Thus I've thought of a way to stage the conversion:
>
> - First, linux-nat.c is changed to support either the old-style target
> (overriding deprecated_child_ops entries) or new-style targets
> implemented via a linux_target () routine. The new style is selected
> by defining USE_LINUX_TARGET in the nm file.
>
Hmm, it would be preferable to have it the other way around, since
that would make eliminating the nm-linux.h files, but I can see why
you did it this way. In the end we might just define USE_LINUX_TARGET
if GDB_NM_FILE isn't defined. So it's not really important. I've
added some more comments on the patch inline.
>
> - Then, Linux subtargets can be converted one by one to use the new style.
> I'd hope the various maintainers would take on their platforms.
I can take care of i386/amd64 and sparc.
> In a subsequent mail I'll send a patch implementing this step for s390.
Cool.
> - Once all targets have been converted, the remains of old-style support
> (and USE_LINUX_TARGET) are removed frome linux-nat.c.
I think we should set a date for removal of that code; say six months
after we check this stuff in. Any Linux target that hasn't been
converted by then will be marked as broken and eventually removed.
>
> The patch below implements the first step. By itself, it shouldn't change
> the behaviour at all. The changes are relatively mechanical; in particular
> the way the miscellaneous thread and process stratum target layers are
> related to each other isn't changed at all -- the new style simply uses
> a target generated by linux_target () instead of deprecated_child_ops
> as process stratum.
>
> To avoid calling child_xfer_memory I had to switch to using xfer_partial
> instead. This change also bubbled up to linux-thread-db.c. (But seeing
> as xfer_memory is deprecated, that's probably a good idea anyway.)
Indeed. When I did conversions in the past the
depreceated_xfer_memory always came back to haunt me, so we have to be
a bit careful. Did you test your patch on another Linux target that
wasn't converted yet?
> What do you think of this approach?
I think this should be committed. However, since Daniel did some work
in this area before, I'd like to give him the opportunity to comment.
Can you keep this patch on the backburner until he's back?
> Index: gdb/linux-nat.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/linux-nat.c,v
> retrieving revision 1.31
> diff -c -p -r1.31 linux-nat.c
> *** gdb/linux-nat.c 9 Aug 2005 16:35:45 -0000 1.31
> --- gdb/linux-nat.c 18 Aug 2005 23:45:50 -0000
[snip]
> + /* Create a prototype generic Linux target. The client can override
> + it with local methods. */
> +
> + struct target_ops *
> + linux_target (void)
> + {
> + struct target_ops *t;
> +
> + t = inf_ptrace_target ();
> + t->to_wait = child_wait;
> + t->to_kill = kill_inferior;
> + t->to_insert_fork_catchpoint = child_insert_fork_catchpoint;
> + t->to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
> + t->to_insert_exec_catchpoint = child_insert_exec_catchpoint;
> + t->to_pid_to_exec_file = child_pid_to_exec_file;
> + t->to_post_startup_inferior = child_post_startup_inferior;
> + t->to_post_attach = child_post_attach;
> + t->to_follow_fork = child_follow_fork;
> + t->to_find_memory_regions = linux_nat_find_memory_regions;
> + t->to_make_corefile_notes = linux_nat_make_corefile_notes;
> +
> + inf_ptrace_xfer_partial = t->to_xfer_partial;
> + t->to_xfer_partial = linux_xfer_partial;
> +
> + linux_ops = t;
> + return t;
> + }
> + #endif /* USE_LINUX_TARGET */
Daniels earlier attempt had linux_target accept a `struct target_ops
*' as an argument to serve as an alternative for a plain
inf_ptrace_target(). I thought that was necessary for i386 and sparc
Linux targets, but I think I've convinced myself that it isn't.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC/RFA] Target vectors for native Linux targets
2005-08-21 10:48 ` Mark Kettenis
@ 2005-08-21 15:21 ` Ulrich Weigand
2005-08-21 15:53 ` Mark Kettenis
0 siblings, 1 reply; 14+ messages in thread
From: Ulrich Weigand @ 2005-08-21 15:21 UTC (permalink / raw)
To: Mark Kettenis; +Cc: uweigand, manjo, gdb-patches
Mark Kettenis wrote:
> Hmm, it would be preferable to have it the other way around, since
> that would make eliminating the nm-linux.h files, but I can see why
> you did it this way. In the end we might just define USE_LINUX_TARGET
> if GDB_NM_FILE isn't defined. So it's not really important. I've
> added some more comments on the patch inline.
I guess we could make a config/nm-new-linux.h or something -- that
would be a (temporary) new nm file, but would allow to remove the
per-platform Linux nm files as platforms are converted over ...
> > To avoid calling child_xfer_memory I had to switch to using xfer_partial
> > instead. This change also bubbled up to linux-thread-db.c. (But seeing
> > as xfer_memory is deprecated, that's probably a good idea anyway.)
>
> Indeed. When I did conversions in the past the
> depreceated_xfer_memory always came back to haunt me, so we have to be
> a bit careful. Did you test your patch on another Linux target that
> wasn't converted yet?
I tested it on s390 *without* the follow-up patch, and that went
fine as well ...
> > What do you think of this approach?
>
> I think this should be committed. However, since Daniel did some work
> in this area before, I'd like to give him the opportunity to comment.
> Can you keep this patch on the backburner until he's back?
Sure. Thanks for your comments!
> Daniels earlier attempt had linux_target accept a `struct target_ops
> *' as an argument to serve as an alternative for a plain
> inf_ptrace_target(). I thought that was necessary for i386 and sparc
> Linux targets, but I think I've convinced myself that it isn't.
Since you can always override the target functions afterwards,
I'm not sure why this would be necessary ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC/RFA] Target vectors for native Linux targets
2005-08-21 15:21 ` Ulrich Weigand
@ 2005-08-21 15:53 ` Mark Kettenis
2005-09-04 15:48 ` Daniel Jacobowitz
0 siblings, 1 reply; 14+ messages in thread
From: Mark Kettenis @ 2005-08-21 15:53 UTC (permalink / raw)
To: uweigand; +Cc: manjo, gdb-patches
> From: Ulrich Weigand <uweigand@de.ibm.com>
> Date: Sun, 21 Aug 2005 15:28:31 +0200 (CEST)
>
> Mark Kettenis wrote:
>
> > Hmm, it would be preferable to have it the other way around, since
> > that would make eliminating the nm-linux.h files, but I can see why
> > you did it this way. In the end we might just define USE_LINUX_TARGET
> > if GDB_NM_FILE isn't defined. So it's not really important. I've
> > added some more comments on the patch inline.
>
> I guess we could make a config/nm-new-linux.h or something -- that
> would be a (temporary) new nm file, but would allow to remove the
> per-platform Linux nm files as platforms are converted over ...
Don't bother. All the cruft in there has to go away eventually.
Making it more cruftier in the meantime isn't a problem.
> > Indeed. When I did conversions in the past the
> > depreceated_xfer_memory always came back to haunt me, so we have to be
> > a bit careful. Did you test your patch on another Linux target that
> > wasn't converted yet?
>
> I tested it on s390 *without* the follow-up patch, and that went
> fine as well ...
Should be. Although it wouldn't hurt if people tested this patch on
their favourite Linux system.
> > Daniels earlier attempt had linux_target accept a `struct target_ops
> > *' as an argument to serve as an alternative for a plain
> > inf_ptrace_target(). I thought that was necessary for i386 and sparc
> > Linux targets, but I think I've convinced myself that it isn't.
>
> Since you can always override the target functions afterwards,
> I'm not sure why this would be necessary ...
I think Daniels earlier patch did things a little bit differently,
eliminating the Linux pseudo-LWP layer. That made overriding things
afterwards more difficult. All the more reason to go with your patch
instead of reviving Daniels old one.
Mark
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC/RFA] Target vectors for native Linux targets
2005-08-21 15:53 ` Mark Kettenis
@ 2005-09-04 15:48 ` Daniel Jacobowitz
0 siblings, 0 replies; 14+ messages in thread
From: Daniel Jacobowitz @ 2005-09-04 15:48 UTC (permalink / raw)
To: Mark Kettenis; +Cc: uweigand, manjo, gdb-patches
Comments on the actual patch to follow, separately.
On Sun, Aug 21, 2005 at 05:20:59PM +0200, Mark Kettenis wrote:
> > From: Ulrich Weigand <uweigand@de.ibm.com>
> > Date: Sun, 21 Aug 2005 15:28:31 +0200 (CEST)
> >
> > Mark Kettenis wrote:
> >
> > > Hmm, it would be preferable to have it the other way around, since
> > > that would make eliminating the nm-linux.h files, but I can see why
> > > you did it this way. In the end we might just define USE_LINUX_TARGET
> > > if GDB_NM_FILE isn't defined. So it's not really important. I've
> > > added some more comments on the patch inline.
> >
> > I guess we could make a config/nm-new-linux.h or something -- that
> > would be a (temporary) new nm file, but would allow to remove the
> > per-platform Linux nm files as platforms are converted over ...
>
> Don't bother. All the cruft in there has to go away eventually.
> Making it more cruftier in the meantime isn't a problem.
Half of Mark's followup comments were about the mechanism to do this a
target at a time. Let's not. My original patch covered every single
GNU/Linux target and I tested more than half of them. I don't know if
I'll redo the mammoth testing sequence this time, but only a handful
(i386, ia64, s390, maybe sparc? don't recall) were particularly unique.
I have access to the great majority of GNU/Linux targets supported by
GDB for testing.
> > > Daniels earlier attempt had linux_target accept a `struct target_ops
> > > *' as an argument to serve as an alternative for a plain
> > > inf_ptrace_target(). I thought that was necessary for i386 and sparc
> > > Linux targets, but I think I've convinced myself that it isn't.
My goal was not just to start using inf_ptrace_target, but to unify the
single-threaded and multi-threaded target vectors. The multi-threaded
target provides its own to_resume which calls child_resume.
i386-linux-nat.c provides its own child_resume which works around an
old Linux kernel bug.
In Ulrich's patch, the target could modify linux_ops, which is exposed
to it by the return value of linux_target (). This would cease to work
when linux_target started to return a multithreaded target.
But the way I did it was pretty ugly and Andrew's suggestion in the
followup discussion was much nicer (barring naming); just provide a
hook in linux-nat.h to implement the same functionality differently.
And I've got some other ideas on how to neaten it up, though they may
not turn out to be useful.
I've learned some interesting things from reading Ulrich's patch. I'm
going to stitch the two together this afternoon.
> > Since you can always override the target functions afterwards,
> > I'm not sure why this would be necessary ...
>
> I think Daniels earlier patch did things a little bit differently,
> eliminating the Linux pseudo-LWP layer. That made overriding things
> afterwards more difficult. All the more reason to go with your patch
> instead of reviving Daniels old one.
There's a lot of complexity and target-stack-violation caused by the
fact that the GNU/Linux "child" stratum can't handle multithreaded
applications. It really needs to die.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC/RFA] Target vectors for native Linux targets
2005-08-19 0:53 ` [RFC/RFA] Target vectors for native Linux targets Ulrich Weigand
2005-08-21 10:48 ` Mark Kettenis
@ 2005-09-04 22:48 ` Daniel Jacobowitz
2005-09-05 17:32 ` Ulrich Weigand
1 sibling, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2005-09-04 22:48 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: Mark Kettenis, manjo, gdb-patches
I'm presenting an alternative patch, stealing bits from mine last
December and other clever bits from Ulrich's. His patch was much
prettier than mine - but missed some important things that generated
ugliness in my first patch (for instance non-FETCH_INFERIOR_REGISTERS
targets). I've come up with cleaner solutions than I did the first
time round.
I've also addressed the comments the first patch received.
On Fri, Aug 19, 2005 at 02:51:24AM +0200, Ulrich Weigand wrote:
> One problem with the conversion is that I wouldn't want to have to
> convert all the various Linux subtargets at the same time. It's a
> lot of work, and I'm unable to test most of those platforms. Thus
> I've thought of a way to stage the conversion:
I bit the bullet and did them all, since I had most of it lying around
anyway.
> To avoid calling child_xfer_memory I had to switch to using xfer_partial
> instead. This change also bubbled up to linux-thread-db.c. (But seeing
> as xfer_memory is deprecated, that's probably a good idea anyway.)
Definitely. I moved the bits around; you preserved only calling
linux_proc_xfer_memory for multi-threaded targets, but in fact the only
reason that was the case was that there was no easy way to call it for
single-threaded targets at the time. So this should speed up GDB a bit
when /proc is available.
This patch has only been tested on i686-pc-linux-gnu at the moment, but
it's been mightily proofread, and I have high confidence in it. It
obsoletes about half your posted patch for S/390 (the watchpoint bits
are an obvious follow-up). Could you give this a spin on S/390 for me?
Assuming it looks good, I will try to dig up another architecture or
two to try.
--
Daniel Jacobowitz
CodeSourcery, LLC
2005-09-04 Daniel Jacobowitz <dan@codesourcery.com>
Ulrich Weigand <uweigand@de.ibm.com>
* Makefile.in (ALLDEPFILES): Update.
(alpha-linux-nat.o, sparc-linux-nat.o): New rules.
(amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o)
(i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o)
(m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o)
(sparc64-linux-nat.o): Update dependencies.
* alpha-linux-nat.c, sparc-linux-nat.c: New files.
* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(amd64_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(amd64_linux_child_post_start_inferior): Renamed from
child_post_startup_inferior and made static. Call
super_post_startup_inferior.
(super_post_startup_inferior): New.
(_initialize_amd64_linux_nat): Set it. Call linux_target and
add_target.
* arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(arm_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_arm_linux_nat): Add a prototype. Use linux_target and
add_target.
* hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(hppa_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_hppa_linux_nat): New function.
* i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(i386_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(i386_linux_resume): Renamed from child_resume and made static.
(i386_linux_child_post_start_inferior): Renamed from
child_post_startup_inferior and made static. Call
super_post_startup_inferior.
(super_post_startup_inferior): New.
(_initialize_i386_linux_nat): New function.
* i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef.
* ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove.
(super_xfer_partial): New.
(ia64_linux_xfer_partial): New function. Use it.
(_initialize_ia64_linux_nat): New function.
* inf-ptrace.c (inf_ptrace_fetch_register): Use
gdbarch_cannot_fetch_register. Fix some comments.
(inf_ptrace_store_register): Use gdbarch_cannot_store_register. Fix
some comments.
* linux-nat.c: Include "inf-ptrace.h" and "auxv.h".
(linux_ops, super_xfer_partial): New variables.
(linux_child_post_startup_inferior): Make static.
(child_post_startup_inferior): Delete.
(linux_nat_attach, linux_nat_detach, resume_callback)
(linux_nat_resume, linux_nat_wait, linux_nat_create_inferior)
(linux_nat_mourn_inferior): Use linux_ops instead of
deprecated_child_ops.
(child_wait): Do not depend on CHILD_WAIT.
(linux_nat_xfer_memory): Remove, replace by ...
(linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial
instead of linux_proc_xfer_memory and child_xfer_memory.
(linux_nat_fetch_registers, linux_nat_store_registers)
(linux_nat_child_post_startup_inferior): New functions.
(init_linux_nat_ops): Use the new functions.
(linux_proc_xfer_memory): Remove, replace by ...
(linux_proc_xfer_partial): ... this. Make static.
(linux_xfer_partial, linux_target): New functions.
(_initialize_linux_nat): Do not modify deprecated_child_ops.
* linux-nat.h (linux_proc_xfer_memory): Remove prototype.
(struct mem_attrib, struct target_ops): Remove forward declarations.
(linux_child_post_startup_inferior): Remove prototype.
(linux_target): Add prototype.
* linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ...
(thread_db_xfer_partial): ... this.
(init_thread_db_ops): Set to_xfer_partial instead of
deprecated_xfer_memory.
* m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(m32r_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_m32r_linux_nat): New function.
* m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(m68k_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(old_fetch_inferior_registers, old_store_inferior_registers): Made
static.
(_initialize_m68k_linux_nat): Use linux_target and add_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): New function.
* ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(ppc_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_ppc_linux_nat): New function.
* s390-nat.c (s390_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(s390_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_s390_nat): New function.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
linux_target and add_target.
* config/nm-linux.h: Don't include "auxv.h".
(struct target_waitstatus, child_wait, CHILD_WAIT)
(CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT)
(CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT)
(CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK)
(DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete.
* config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o
and inftarg.o with inf-ptrace.o and alpha-linux-nat.o.
* config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and
inftarg.o with sparc-linux-nat.o.
* config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and
inftarg.o.
* config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and
inftarg.o with inf-ptrace.o.
* config/i386/linux.mh (NATDEPFILES): Likewise.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* config/ia64/linux.mh (NATDEPFILES): Likewise.
* config/m32r/linux.mh (NATDEPFILES): Likewise.
* config/m68k/linux.mh (NATDEPFILES): Likewise.
* config/mips/linux.mh (NATDEPFILES): Likewise.
* config/pa/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise.
* config/s390/s390.mh (NATDEPFILES): Likewise.
* config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define.
(LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define.
* config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR):
Don't define.
* config/ia64/nm-linux.h: Don't include "target.h".
(NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove.
* config/djgpp/fnchange.lst: Add alpha-linux-tdep.c,
alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.751
diff -u -p -r1.751 Makefile.in
--- Makefile.in 3 Sep 2005 00:35:45 -0000 1.751
+++ Makefile.in 4 Sep 2005 20:58:29 -0000
@@ -1374,7 +1374,7 @@ MAKEOVERRIDES=
ALLDEPFILES = \
aix-thread.c \
- alpha-nat.c alphabsd-nat.c \
+ alpha-nat.c alphabsd-nat.c alpha-linux-nat.c \
alpha-tdep.c alpha-linux-tdep.c alphabsd-tdep.c alphanbsd-tdep.c \
alpha-osf1-tdep.c alphafbsd-tdep.c alpha-mdebug-tdep.c \
amd64-nat.c amd64-tdep.c \
@@ -1416,6 +1416,7 @@ ALLDEPFILES = \
m32r-linux-nat.c m32r-linux-tdep.c \
m68k-tdep.c \
m68kbsd-nat.c m68kbsd-tdep.c \
+ m68klinux-nat.c m68klinux-tdep.c \
m88k-tdep.c m88kbsd-nat.c \
mcore-tdep.c \
mips-linux-nat.c mips-linux-tdep.c \
@@ -1439,6 +1440,7 @@ ALLDEPFILES = \
ser-go32.c ser-pipe.c ser-tcp.c \
sh-tdep.c sh64-tdep.c shnbsd-tdep.c shnbsd-nat.c \
solib-irix.c solib-svr4.c solib-sunos.c \
+ sparc-linux-nat.c \
sparc-linux-tdep.c sparc-nat.c sparc-sol2-nat.c sparc-sol2-tdep.c \
sparc-tdep.c sparc-sol2-nat.c sparc-sol2-tdep.c sparc64-linux-nat.c \
sparc64-linux-tdep.c sparc64-nat.c sparc64-sol2-tdep.c \
@@ -1669,6 +1671,7 @@ alphabsd-tdep.o: alphabsd-tdep.c $(defs_
$(alphabsd_tdep_h)
alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(osabi_h) \
$(alpha_tdep_h)
+alpha-linux-nat.o: alpha-linux-nat.c $(defs_h) $(target_h) $(linux_nat_h)
alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(frame_h) $(gdb_assert_h) \
$(osabi_h) $(solib_svr4_h) $(alpha_tdep_h)
alpha-mdebug-tdep.o: alpha-mdebug-tdep.c $(defs_h) $(frame_h) \
@@ -1699,7 +1702,7 @@ amd64fbsd-tdep.o: amd64fbsd-tdep.c $(def
amd64-linux-nat.o: amd64-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
$(gdb_proc_service_h) $(gregset_h) $(amd64_tdep_h) \
- $(i386_linux_tdep_h) $(amd64_nat_h)
+ $(i386_linux_tdep_h) $(amd64_nat_h) $(target_h)
amd64-linux-tdep.o: amd64-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
$(regcache_h) $(osabi_h) $(symtab_h) $(gdb_string_h) $(amd64_tdep_h) \
$(solib_svr4_h)
@@ -1732,7 +1735,8 @@ arch-utils.o: arch-utils.c $(defs_h) $(a
$(gdb_assert_h) $(sim_regno_h) $(gdbcore_h) $(osabi_h) $(version_h) \
$(floatformat_h)
arm-linux-nat.o: arm-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
- $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h)
+ $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h) \
+ $(target_h) $(linux_nat_h)
arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \
$(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \
$(doublest_h) $(solib_svr4_h) $(osabi_h) $(arm_tdep_h) \
@@ -2013,7 +2017,8 @@ hppa-hpux-tdep.o: hppa-hpux-tdep.c $(def
$(hppa_tdep_h) $(solib_som_h) $(solib_pa64_h) $(regset_h) \
$(exceptions_h) $(gdb_string_h)
hppa-linux-nat.o: hppa-linux-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
- $(gdb_string_h) $(inferior_h) $(hppa_tdep_h) $(gregset_h)
+ $(gdb_string_h) $(inferior_h) $(hppa_tdep_h) $(gregset_h) \
+ $(target_h) $(linux_nat_h)
hppa-linux-tdep.o: hppa-linux-tdep.c $(defs_h) $(gdbcore_h) $(osabi_h) \
$(target_h) $(objfiles_h) $(solib_svr4_h) $(glibc_tdep_h) \
$(frame_unwind_h) $(trad_frame_h) $(dwarf2_frame_h) $(value_h) \
@@ -2050,7 +2055,7 @@ i386gnu-tdep.o: i386gnu-tdep.c $(defs_h)
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
$(gregset_h) $(i387_tdep_h) $(i386_tdep_h) $(i386_linux_tdep_h) \
- $(gdb_proc_service_h)
+ $(gdb_proc_service_h) $(target_h)
i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
$(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
$(dwarf2_frame_h) $(gdb_string_h) $(i386_tdep_h) \
@@ -2092,7 +2097,7 @@ i387-tdep.o: i387-tdep.c $(defs_h) $(dou
$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(i387_tdep_h)
ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \
$(target_h) $(gdbcore_h) $(regcache_h) $(ia64_tdep_h) $(gdb_wait_h) \
- $(gregset_h)
+ $(gregset_h) $(linux_nat_h)
ia64-linux-tdep.o: ia64-linux-tdep.c $(defs_h) $(ia64_tdep_h) \
$(arch_utils_h) $(gdbcore_h) $(regcache_h) $(osabi_h) $(solib_svr4_h)
ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
@@ -2174,8 +2179,8 @@ linespec.o: linespec.c $(defs_h) $(symta
$(objc_lang_h) $(linespec_h) $(exceptions_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) $(elf_bfd_h) $(gregset_h) $(gdbcore_h) \
- $(gdbthread_h) $(gdb_stat_h)
+ $(gdbcmd_h) $(regcache_h) $(inf_ptrace.h) $(auxv.h) $(elf_bfd_h) \
+ $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(gdb_stat_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) \
$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \
@@ -2194,7 +2199,7 @@ m2-valprint.o: m2-valprint.c $(defs_h) $
$(m2_lang_h) $(c_lang_h)
m32r-linux-nat.o: m32r-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
- $(gregset_h) $(m32r_tdep_h)
+ $(gregset_h) $(m32r_tdep_h) $(target_h)
m32r-linux-tdep.o: m32r-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
$(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
$(regset_h) $(gdb_string_h) $(glibc_tdep_h) $(solib_svr4_h) \
@@ -2225,7 +2230,7 @@ m68kbsd-tdep.o: m68kbsd-tdep.c $(defs_h)
m68klinux-nat.o: m68klinux-nat.c $(defs_h) $(frame_h) $(inferior_h) \
$(language_h) $(gdbcore_h) $(gdb_string_h) $(regcache_h) \
$(m68k_tdep_h) $(gdb_stat_h) $(floatformat_h) $(target_h) \
- $(gregset_h)
+ $(gregset_h) $(target_h) $(linux_nat_h)
m68klinux-tdep.o: m68klinux-tdep.c $(defs_h) $(gdbcore_h) $(doublest_h) \
$(floatformat_h) $(frame_h) $(target_h) $(gdb_string_h) \
$(gdbtypes_h) $(osabi_h) $(regcache_h) $(objfiles_h) $(symtab_h) \
@@ -2276,7 +2281,8 @@ mips64obsd-tdep.o: mips64obsd-tdep.c $(d
$(regset_h) $(trad_frame_h) $(tramp_frame_h) $(gdb_assert_h) \
$(gdb_string_h) $(mips_tdep_h) $(solib_svr4_h)
mips-irix-tdep.o: mips-irix-tdep.c $(defs_h) $(osabi_h) $(elf_bfd_h)
-mips-linux-nat.o: mips-linux-nat.c $(defs_h) $(mips_tdep_h)
+mips-linux-nat.o: mips-linux-nat.c $(defs_h) $(mips_tdep_h) $(target_h) \
+ $(linux_nat_h)
mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \
$(solib_svr4_h) $(osabi_h) $(mips_tdep_h) $(gdb_string_h) \
$(gdb_assert_h) $(frame_h) $(regcache_h) $(trad_frame_h) \
@@ -2368,7 +2374,8 @@ ppcbug-rom.o: ppcbug-rom.c $(defs_h) $(g
$(serial_h) $(regcache_h)
ppc-linux-nat.o: ppc-linux-nat.c $(defs_h) $(gdb_string_h) $(frame_h) \
$(inferior_h) $(gdbcore_h) $(regcache_h) $(gdb_assert_h) \
- $(gdb_wait_h) $(gregset_h) $(ppc_tdep_h)
+ $(gdb_wait_h) $(gregset_h) $(ppc_tdep_h) $(target_h) \
+ $(linux_nat_h)
ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(frame_h) $(inferior_h) \
$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \
$(objfiles_h) $(regcache_h) $(value_h) $(osabi_h) $(regset_h) \
@@ -2479,7 +2486,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $
$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
$(frame_unwind_h) $(frame_base_h) $(reggroups_h)
s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
- $(s390_tdep_h)
+ $(s390_tdep_h) $(target_h) $(linux_nat_h)
s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) \
$(tm_h) $(__bfd_bfd_h) $(floatformat_h) $(regcache_h) \
@@ -2579,7 +2586,7 @@ sparc64fbsd-tdep.o: sparc64fbsd-tdep.c $
$(target_h) $(trad_frame_h) $(gdb_assert_h) $(gdb_string_h) \
$(sparc64_tdep_h) $(solib_svr4_h)
sparc64-linux-nat.o: sparc64-linux-nat.c $(defs_h) $(sparc64_tdep_h) \
- $(sparc_nat_h)
+ $(sparc_nat_h) $(inferior_h) $(target_h) $(linux_nat_h)
sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(frame_h) \
$(frame_unwind_h) $(gdbarch_h) $(osabi_h) $(solib_svr4_h) \
$(symtab_h) $(trad_frame_h) $(tramp_frame_h) $(sparc64_tdep_h)
@@ -2602,6 +2609,8 @@ sparc64-tdep.o: sparc64-tdep.c $(defs_h)
$(gdbcore_h) $(gdbtypes_h) $(inferior_h) $(symtab_h) $(objfiles_h) \
$(osabi_h) $(regcache_h) $(target_h) $(value_h) $(gdb_assert_h) \
$(gdb_string_h) $(sparc64_tdep_h)
+sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(inferior_h) $(target_h) \
+ $(linux_nat_h)
sparc-linux-tdep.o: sparc-linux-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \
$(frame_unwind_h) $(gdbarch_h) $(gdbcore_h) $(osabi_h) $(regcache_h) \
$(solib_svr4_h) $(symtab_h) $(trad_frame_h) $(tramp_frame_h) \
Index: alpha-linux-nat.c
===================================================================
RCS file: alpha-linux-nat.c
diff -N alpha-linux-nat.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ alpha-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -0,0 +1,32 @@
+/* Low level Alpha GNU/Linux interface, for GDB when running native.
+ Copyright 2005
+ Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "target.h"
+#include "linux-nat.h"
+
+void _initialialize_alpha_linux_nat (void);
+
+void
+_initialize_alpha_linux_nat (void)
+{
+ add_target (linux_target ());
+}
Index: amd64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 amd64-linux-nat.c
--- amd64-linux-nat.c 5 Jan 2005 15:43:42 -0000 1.9
+++ amd64-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux x86-64.
- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.
@@ -147,8 +147,8 @@ fill_fpregset (elf_fpregset_t *fpregsetp
this for all registers (including the floating point and SSE
registers). */
-void
-fetch_inferior_registers (int regnum)
+static void
+amd64_linux_fetch_inferior_registers (int regnum)
{
int tid;
@@ -184,8 +184,8 @@ fetch_inferior_registers (int regnum)
-1, do this for all registers (including the floating-point and SSE
registers). */
-void
-store_inferior_registers (int regnum)
+static void
+amd64_linux_store_inferior_registers (int regnum)
{
int tid;
@@ -360,11 +360,13 @@ ps_get_thread_area (const struct ps_proc
}
\f
-void
-child_post_startup_inferior (ptid_t ptid)
+static void (*super_post_startup_inferior) (ptid_t ptid);
+
+static void
+amd64_linux_child_post_startup_inferior (ptid_t ptid)
{
i386_cleanup_dregs ();
- linux_child_post_startup_inferior (ptid);
+ super_post_startup_inferior (ptid);
}
\f
@@ -374,6 +376,8 @@ void _initialize_amd64_linux_nat (void);
void
_initialize_amd64_linux_nat (void)
{
+ struct target_ops *t;
+
amd64_native_gregset32_reg_offset = amd64_linux_gregset32_reg_offset;
amd64_native_gregset32_num_regs = I386_LINUX_NUM_REGS;
amd64_native_gregset64_reg_offset = amd64_linux_gregset64_reg_offset;
@@ -382,4 +386,18 @@ _initialize_amd64_linux_nat (void)
== amd64_native_gregset32_num_regs);
gdb_assert (ARRAY_SIZE (amd64_linux_gregset64_reg_offset)
== amd64_native_gregset64_num_regs);
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Override the GNU/Linux inferior startup hook. */
+ super_post_startup_inferior = t->to_post_startup_inferior;
+ t->to_post_startup_inferior = amd64_linux_child_post_startup_inferior;
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
+ t->to_store_registers = amd64_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
}
Index: arm-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-nat.c,v
retrieving revision 1.23
diff -u -p -r1.23 arm-linux-nat.c
--- arm-linux-nat.c 29 Mar 2005 16:58:23 -0000 1.23
+++ arm-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -1,5 +1,6 @@
/* GNU/Linux on ARM native support.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,6 +24,8 @@
#include "gdbcore.h"
#include "gdb_string.h"
#include "regcache.h"
+#include "target.h"
+#include "linux-nat.h"
#include "arm-tdep.h"
@@ -547,8 +550,8 @@ store_regs (void)
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */
-void
-fetch_inferior_registers (int regno)
+static void
+arm_linux_fetch_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -569,8 +572,8 @@ fetch_inferior_registers (int regno)
regno == -1, otherwise store all general registers or all floating
point registers depending upon the value of regno. */
-void
-store_inferior_registers (int regno)
+static void
+arm_linux_store_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -716,8 +719,22 @@ get_linux_version (unsigned int *vmajor,
return ((*vmajor << 16) | (*vminor << 8) | *vrelease);
}
+void _initialize_arm_linux_nat (void);
+
void
_initialize_arm_linux_nat (void)
{
+ struct target_ops *t;
+
os_version = get_linux_version (&os_major, &os_minor, &os_release);
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = arm_linux_fetch_inferior_registers;
+ t->to_store_registers = arm_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
}
Index: hppa-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-linux-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 hppa-linux-nat.c
--- hppa-linux-nat.c 11 Feb 2005 04:05:50 -0000 1.9
+++ hppa-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -1,6 +1,6 @@
/* Functions specific to running GDB native on HPPA running GNU/Linux.
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,6 +24,8 @@
#include "regcache.h"
#include "gdb_string.h"
#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"
#include <sys/procfs.h>
#include <sys/ptrace.h>
@@ -267,8 +269,8 @@ store_register (int regno)
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */
-void
-fetch_inferior_registers (int regno)
+static void
+hppa_linux_fetch_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -285,8 +287,8 @@ fetch_inferior_registers (int regno)
regno == -1, otherwise store all general registers or all floating
point registers depending upon the value of regno. */
-void
-store_inferior_registers (int regno)
+static void
+hppa_linux_store_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -374,3 +376,21 @@ fill_fpregset (gdb_fpregset_t *fpregsetp
regcache_raw_collect (current_regcache, i, to);
}
}
+
+void _initialize_hppa_linux_nat (void);
+
+void
+_initialize_hppa_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = arm_linux_fetch_inferior_registers;
+ t->to_store_registers = arm_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: i386-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
retrieving revision 1.66
diff -u -p -r1.66 i386-linux-nat.c
--- i386-linux-nat.c 13 Aug 2005 22:03:46 -0000 1.66
+++ i386-linux-nat.c 4 Sep 2005 20:58:29 -0000
@@ -24,6 +24,7 @@
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
+#include "target.h"
#include "linux-nat.h"
#include "gdb_assert.h"
@@ -480,8 +481,8 @@ cannot_store_register (int regno)
this for all registers (including the floating point and SSE
registers). */
-void
-fetch_inferior_registers (int regno)
+static void
+i386_linux_fetch_inferior_registers (int regno)
{
int tid;
@@ -514,7 +515,7 @@ fetch_inferior_registers (int regno)
/* The call above might reset `have_ptrace_getregs'. */
if (!have_ptrace_getregs)
{
- fetch_inferior_registers (regno);
+ i386_linux_fetch_inferior_registers (regno);
return;
}
@@ -552,8 +553,8 @@ fetch_inferior_registers (int regno)
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-void
-store_inferior_registers (int regno)
+static void
+i386_linux_store_inferior_registers (int regno)
{
int tid;
@@ -755,8 +756,8 @@ static const unsigned char linux_syscall
If STEP is nonzero, single-step it.
If SIGNAL is nonzero, give it that signal. */
-void
-child_resume (ptid_t ptid, int step, enum target_signal signal)
+static void
+i386_linux_resume (ptid_t ptid, int step, enum target_signal signal)
{
int pid = PIDGET (ptid);
@@ -814,9 +815,34 @@ child_resume (ptid_t ptid, int step, enu
perror_with_name (("ptrace"));
}
-void
-child_post_startup_inferior (ptid_t ptid)
+static void (*super_post_startup_inferior) (ptid_t ptid);
+
+static void
+i386_linux_child_post_startup_inferior (ptid_t ptid)
{
i386_cleanup_dregs ();
- linux_child_post_startup_inferior (ptid);
+ super_post_startup_inferior (ptid);
+}
+
+void
+_initialize_i386_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Override the default ptrace resume method. */
+ t->to_resume = i386_linux_resume;
+
+ /* Override the GNU/Linux inferior startup hook. */
+ super_post_startup_inferior = t->to_post_startup_inferior;
+ t->to_post_startup_inferior = i386_linux_child_post_startup_inferior;
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = i386_linux_fetch_inferior_registers;
+ t->to_store_registers = i386_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
}
Index: i386-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nat.c,v
retrieving revision 1.11
diff -u -p -r1.11 i386-nat.c
--- i386-nat.c 21 Feb 2005 17:14:03 -0000 1.11
+++ i386-nat.c 4 Sep 2005 20:58:30 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for the i386.
- Copyright 2001, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -231,8 +231,6 @@ i386_cleanup_dregs (void)
dr_status_mirror = 0;
}
-#ifndef LINUX_CHILD_POST_STARTUP_INFERIOR
-
/* Reset all debug registers at each new startup to avoid missing
watchpoints after restart. */
@@ -242,8 +240,6 @@ child_post_startup_inferior (ptid_t ptid
i386_cleanup_dregs ();
}
-#endif /* LINUX_CHILD_POST_STARTUP_INFERIOR */
-
/* Print the values of the mirrored debug registers. This is called
when maint_show_dr is non-zero. To set that up, type "maint
show-debug-regs" at GDB's prompt. */
Index: ia64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-linux-nat.c,v
retrieving revision 1.28
diff -u -p -r1.28 ia64-linux-nat.c
--- ia64-linux-nat.c 11 Feb 2005 04:05:51 -0000 1.28
+++ ia64-linux-nat.c 4 Sep 2005 20:58:30 -0000
@@ -28,6 +28,7 @@
#include "gdbcore.h"
#include "regcache.h"
#include "ia64-tdep.h"
+#include "linux-nat.h"
#include <signal.h>
#include <sys/ptrace.h>
@@ -666,12 +667,38 @@ ia64_linux_stopped_by_watchpoint (void)
return ia64_linux_stopped_data_address (&addr);
}
-LONGEST
-ia64_linux_xfer_unwind_table (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- void *readbuf, const void *writebuf,
- ULONGEST offset, LONGEST len)
+LONGEST (*super_xfer_partial) (struct target_ops *, enum target_object,
+ const char *, void *, const void *,
+ ULONGEST, LONGEST);
+
+static LONGEST
+ia64_linux_xfer_partial (struct target_ops *ops,
+ enum target_object object,
+ const char *annex,
+ void *readbuf, const void *writebuf,
+ ULONGEST offset, LONGEST len)
+{
+ if (object == TARGET_OBJECT_UNWIND_TABLE && writebuf == NULL && offset == 0)
+ return syscall (__NR_getunwind, readbuf, len);
+
+ return super_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+}
+
+void _initialize_ia64_linux_nat (void);
+
+void
+_initialize_ia64_linux_nat (void)
{
- return syscall (__NR_getunwind, readbuf, len);
+ struct target_ops *t = linux_target ();
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Override the default to_xfer_partial. */
+ super_xfer_partial = t->to_xfer_partial;
+ t->to_xfer_partial = ia64_linux_xfer_partial;
+
+ /* Register the target. */
+ add_target (t);
}
Index: inf-ptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ptrace.c,v
retrieving revision 1.25
diff -u -p -r1.25 inf-ptrace.c
--- inf-ptrace.c 4 Sep 2005 16:18:19 -0000 1.25
+++ inf-ptrace.c 4 Sep 2005 20:58:30 -0000
@@ -626,8 +626,14 @@ inf_ptrace_fetch_register (int regnum)
PTRACE_TYPE_RET *buf;
int pid, i;
+ if (gdbarch_cannot_fetch_register (current_gdbarch, regnum))
+ {
+ regcache_raw_supply (current_regcache, regnum, NULL);
+ return;
+ }
+
/* Cater for systems like GNU/Linux, that implement threads as
- seperate processes. */
+ separate processes. */
pid = ptid_get_lwp (inferior_ptid);
if (pid == 0)
pid = ptid_get_pid (inferior_ptid);
@@ -639,7 +645,7 @@ inf_ptrace_fetch_register (int regnum)
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
buf = alloca (size);
- /* Read the register contents from the inferior a chuck at the time. */
+ /* Read the register contents from the inferior a chunk at a time. */
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
errno = 0;
@@ -676,8 +682,11 @@ inf_ptrace_store_register (int regnum)
PTRACE_TYPE_RET *buf;
int pid, i;
+ if (gdbarch_cannot_store_register (current_gdbarch, regnum))
+ return;
+
/* Cater for systems like GNU/Linux, that implement threads as
- seperate processes. */
+ separate processes. */
pid = ptid_get_lwp (inferior_ptid);
if (pid == 0)
pid = ptid_get_pid (inferior_ptid);
@@ -689,7 +698,7 @@ inf_ptrace_store_register (int regnum)
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
buf = alloca (size);
- /* Write the register contents into the inferior a chunk at the time. */
+ /* Write the register contents into the inferior a chunk at a time. */
regcache_raw_collect (current_regcache, regnum, buf);
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.32
diff -u -p -r1.32 linux-nat.c
--- linux-nat.c 4 Sep 2005 16:18:20 -0000 1.32
+++ linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -34,6 +34,8 @@
#include "gdbthread.h"
#include "gdbcmd.h"
#include "regcache.h"
+#include "inf-ptrace.h"
+#include "auxv.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <sys/procfs.h> /* for elf_gregset etc. */
#include "elf-bfd.h" /* for elfcore_write_* */
@@ -81,6 +83,16 @@
#define __WALL 0x40000000 /* Wait for any child. */
#endif
+/* The single-threaded native GNU/Linux target_ops. We save a pointer for
+ the use of the multi-threaded target. */
+static struct target_ops *linux_ops;
+
+/* The saved to_xfer_partial method, inherited from inf-ptrace.c. Called
+ by our to_xfer_partial. */
+LONGEST (*super_xfer_partial) (struct target_ops *, enum target_object,
+ const char *, gdb_byte *, const gdb_byte *,
+ ULONGEST, LONGEST);
+
static int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -319,20 +331,12 @@ child_post_attach (int pid)
linux_enable_event_reporting (pid_to_ptid (pid));
}
-void
+static void
linux_child_post_startup_inferior (ptid_t ptid)
{
linux_enable_event_reporting (ptid);
}
-#ifndef LINUX_CHILD_POST_STARTUP_INFERIOR
-void
-child_post_startup_inferior (ptid_t ptid)
-{
- linux_child_post_startup_inferior (ptid);
-}
-#endif
-
int
child_follow_fork (struct target_ops *ops, int follow_child)
{
@@ -913,7 +917,7 @@ linux_nat_attach (char *args, int from_t
/* FIXME: We should probably accept a list of process id's, and
attach all of them. */
- deprecated_child_ops.to_attach (args, from_tty);
+ linux_ops->to_attach (args, from_tty);
/* Add the initial process as the first LWP to the list. */
lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)));
@@ -1023,7 +1027,7 @@ linux_nat_detach (char *args, int from_t
sigemptyset (&blocked_mask);
inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
- deprecated_child_ops.to_detach (args, from_tty);
+ linux_ops->to_detach (args, from_tty);
}
/* Resume LP. */
@@ -1035,7 +1039,8 @@ resume_callback (struct lwp_info *lp, vo
{
struct thread_info *tp;
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ 0, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n",
@@ -1109,7 +1114,7 @@ linux_nat_resume (ptid_t ptid, int step,
if (resume_all)
iterate_over_lwps (resume_callback, NULL);
- child_resume (ptid, step, signo);
+ linux_ops->to_resume (ptid, step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLR: %s %s, %s (resume event thread)\n",
@@ -1683,8 +1688,6 @@ resumed_callback (struct lwp_info *lp, v
return lp->resumed;
}
-#ifdef CHILD_WAIT
-
/* We need to override child_wait to support attaching to cloned
processes, since a normal wait (as done by the default version)
ignores those processes. */
@@ -1789,8 +1792,6 @@ child_wait (ptid_t ptid, struct target_w
return pid_to_ptid (pid);
}
-#endif
-
/* Stop an active thread, verify it still exists, then resume it. */
static int
@@ -1899,8 +1900,8 @@ retry:
/* Resume the thread. It should halt immediately returning the
pending SIGSTOP. */
registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
@@ -2101,8 +2102,8 @@ retry:
lp->signalled = 0;
registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
@@ -2161,7 +2162,8 @@ retry:
newly attached threads may cause an unwanted delay in
getting them running. */
registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, %s (preempt 'handle')\n",
@@ -2310,7 +2312,7 @@ static void
linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
int from_tty)
{
- deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+ linux_ops->to_create_inferior (exec_file, allargs, env, from_tty);
}
static void
@@ -2325,23 +2327,23 @@ linux_nat_mourn_inferior (void)
sigprocmask (SIG_SETMASK, &normal_mask, NULL);
sigemptyset (&blocked_mask);
- deprecated_child_ops.to_mourn_inferior ();
+ linux_ops->to_mourn_inferior ();
}
-static int
-linux_nat_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
- int write, struct mem_attrib *attrib,
- struct target_ops *target)
+static LONGEST
+linux_nat_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len)
{
struct cleanup *old_chain = save_inferior_ptid ();
- int xfer;
+ LONGEST xfer;
if (is_lwp (inferior_ptid))
inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
- xfer = linux_proc_xfer_memory (memaddr, myaddr, len, write, attrib, target);
- if (xfer == 0)
- xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target);
+ xfer = linux_ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
do_cleanups (old_chain);
return xfer;
@@ -2380,6 +2382,26 @@ linux_nat_pid_to_str (ptid_t ptid)
}
static void
+linux_nat_fetch_registers (int regnum)
+{
+ /* to_fetch_registers will honor the LWP ID, so we can use it directly. */
+ linux_ops->to_fetch_registers (regnum);
+}
+
+static void
+linux_nat_store_registers (int regnum)
+{
+ /* to_store_registers will honor the LWP ID, so we can use it directly. */
+ linux_ops->to_store_registers (regnum);
+}
+
+static void
+linux_nat_child_post_startup_inferior (ptid_t ptid)
+{
+ linux_ops->to_post_startup_inferior (ptid);
+}
+
+static void
init_linux_nat_ops (void)
{
#if 0
@@ -2392,17 +2414,16 @@ init_linux_nat_ops (void)
linux_nat_ops.to_detach = linux_nat_detach;
linux_nat_ops.to_resume = linux_nat_resume;
linux_nat_ops.to_wait = linux_nat_wait;
- /* fetch_inferior_registers and store_inferior_registers will
- honor the LWP id, so we can use them directly. */
- linux_nat_ops.to_fetch_registers = fetch_inferior_registers;
- linux_nat_ops.to_store_registers = store_inferior_registers;
- linux_nat_ops.deprecated_xfer_memory = linux_nat_xfer_memory;
+ linux_nat_ops.to_fetch_registers = linux_nat_fetch_registers;
+ linux_nat_ops.to_store_registers = linux_nat_store_registers;
+ linux_nat_ops.to_xfer_partial = linux_nat_xfer_partial;
linux_nat_ops.to_kill = linux_nat_kill;
linux_nat_ops.to_create_inferior = linux_nat_create_inferior;
linux_nat_ops.to_mourn_inferior = linux_nat_mourn_inferior;
linux_nat_ops.to_thread_alive = linux_nat_thread_alive;
linux_nat_ops.to_pid_to_str = linux_nat_pid_to_str;
- linux_nat_ops.to_post_startup_inferior = child_post_startup_inferior;
+ linux_nat_ops.to_post_startup_inferior
+ = linux_nat_child_post_startup_inferior;
linux_nat_ops.to_post_attach = child_post_attach;
linux_nat_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
linux_nat_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
@@ -2948,14 +2969,22 @@ linux_nat_info_proc_cmd (char *args, int
}
}
-int
-linux_proc_xfer_memory (CORE_ADDR addr, gdb_byte *myaddr, int len, int write,
- struct mem_attrib *attrib, struct target_ops *target)
+/* Implement the to_xfer_partial interface for memory reads using the /proc
+ filesystem. Because we can use a single read() call for /proc, this
+ can be much more efficient than banging away at PTRACE_PEEKTEXT,
+ but it doesn't support writes. */
+
+static LONGEST
+linux_proc_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len)
{
- int fd, ret;
+ LONGEST ret;
+ int fd;
char filename[64];
- if (write)
+ if (object != TARGET_OBJECT_MEMORY || !readbuf)
return 0;
/* Don't bother for one word. */
@@ -2974,9 +3003,9 @@ linux_proc_xfer_memory (CORE_ADDR addr,
32-bit platforms (for instance, SPARC debugging a SPARC64
application). */
#ifdef HAVE_PREAD64
- if (pread64 (fd, myaddr, len, addr) != len)
+ if (pread64 (fd, readbuf, len, offset) != len)
#else
- if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
+ if (lseek (fd, offset, SEEK_SET) == -1 || read (fd, readbuf, len) != len)
#endif
ret = 0;
else
@@ -3067,15 +3096,67 @@ linux_proc_pending_signals (int pid, sig
fclose (procfile);
}
+static LONGEST
+linux_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
+{
+ LONGEST xfer;
+
+ if (object == TARGET_OBJECT_AUXV)
+ return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
+ offset, len);
+
+ xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+ if (xfer != 0)
+ return xfer;
+
+ return super_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+}
+
+/* Create a prototype generic Linux target. The client can override
+ it with local methods. */
+
+struct target_ops *
+linux_target (void)
+{
+ struct target_ops *t;
+
+ /* FIXME drow/2005-09-04: The hardcoded use of register_addr should go
+ away. This requires disentangling the various definitions of it
+ (particularly alpha-nat.c's). */
+#ifdef FETCH_INFERIOR_REGISTERS
+ t = inf_ptrace_target ();
+#else
+ t = inf_ptrace_trad_target (register_addr);
+#endif
+ t->to_wait = child_wait;
+ t->to_kill = kill_inferior;
+ t->to_insert_fork_catchpoint = child_insert_fork_catchpoint;
+ t->to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
+ t->to_insert_exec_catchpoint = child_insert_exec_catchpoint;
+ t->to_pid_to_exec_file = child_pid_to_exec_file;
+ t->to_post_startup_inferior = linux_child_post_startup_inferior;
+ t->to_post_attach = child_post_attach;
+ t->to_follow_fork = child_follow_fork;
+ t->to_find_memory_regions = linux_nat_find_memory_regions;
+ t->to_make_corefile_notes = linux_nat_make_corefile_notes;
+
+ super_xfer_partial = t->to_xfer_partial;
+ t->to_xfer_partial = linux_xfer_partial;
+
+ linux_ops = t;
+ return t;
+}
+
void
_initialize_linux_nat (void)
{
struct sigaction action;
extern void thread_db_init (struct target_ops *);
- deprecated_child_ops.to_find_memory_regions = linux_nat_find_memory_regions;
- deprecated_child_ops.to_make_corefile_notes = linux_nat_make_corefile_notes;
-
add_info ("proc", linux_nat_info_proc_cmd, _("\
Show /proc process information about any running process.\n\
Specify any process id, or use the program being debugged by default.\n\
Index: linux-nat.h
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.h,v
retrieving revision 1.7
diff -u -p -r1.7 linux-nat.h
--- linux-nat.h 9 Aug 2005 16:35:45 -0000 1.7
+++ linux-nat.h 4 Sep 2005 20:58:31 -0000
@@ -1,5 +1,7 @@
/* Native debugging support for GNU/Linux (LWP layer).
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -63,14 +65,6 @@ struct lwp_info
struct lwp_info *next;
};
-/* Read/write to target memory via the Linux kernel's "proc file
- system". */
-struct mem_attrib;
-struct target_ops;
-
-extern int linux_proc_xfer_memory (CORE_ADDR addr, gdb_byte *myaddr, int len,
- int write, struct mem_attrib *attrib,
- struct target_ops *target);
/* Find process PID's pending signal set from /proc/pid/status. */
void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored);
@@ -80,9 +74,12 @@ extern void linux_record_stopped_pid (in
extern void linux_enable_event_reporting (ptid_t ptid);
extern ptid_t linux_handle_extended_wait (int pid, int status,
struct target_waitstatus *ourstatus);
-extern void linux_child_post_startup_inferior (ptid_t ptid);
/* Iterator function for lin-lwp's lwp list. */
struct lwp_info *iterate_over_lwps (int (*callback) (struct lwp_info *,
void *),
void *data);
+
+/* Create a prototype generic Linux target. The client can override
+ it with local methods. */
+struct target_ops * linux_target (void);
Index: linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.9
diff -u -p -r1.9 linux-thread-db.c
--- linux-thread-db.c 28 May 2005 16:44:29 -0000 1.9
+++ linux-thread-db.c 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,7 @@
/* libthread_db assisted debugging support, generic parts.
- Copyright 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -961,12 +962,13 @@ thread_db_wait (ptid_t ptid, struct targ
return ptid;
}
-static int
-thread_db_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
- struct mem_attrib *attrib, struct target_ops *target)
+static LONGEST
+thread_db_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
struct cleanup *old_chain = save_inferior_ptid ();
- int xfer;
+ LONGEST xfer;
if (is_thread (inferior_ptid))
{
@@ -978,9 +980,8 @@ thread_db_xfer_memory (CORE_ADDR memaddr
inferior_ptid = lwp_from_thread (inferior_ptid);
}
- xfer =
- target_beneath->deprecated_xfer_memory (memaddr, myaddr, len, write,
- attrib, target);
+ xfer = target_beneath->to_xfer_partial (ops, object, annex,
+ readbuf, writebuf, offset, len);
do_cleanups (old_chain);
return xfer;
@@ -1298,7 +1299,7 @@ init_thread_db_ops (void)
thread_db_ops.to_wait = thread_db_wait;
thread_db_ops.to_fetch_registers = thread_db_fetch_registers;
thread_db_ops.to_store_registers = thread_db_store_registers;
- thread_db_ops.deprecated_xfer_memory = thread_db_xfer_memory;
+ thread_db_ops.to_xfer_partial = thread_db_xfer_partial;
thread_db_ops.to_kill = thread_db_kill;
thread_db_ops.to_create_inferior = thread_db_create_inferior;
thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior;
Index: m32r-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/m32r-linux-nat.c,v
retrieving revision 1.2
diff -u -p -r1.2 m32r-linux-nat.c
--- m32r-linux-nat.c 11 Feb 2005 18:13:51 -0000 1.2
+++ m32r-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux m32r.
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,6 +24,7 @@
#include "gdbcore.h"
#include "regcache.h"
#include "linux-nat.h"
+#include "target.h"
#include "gdb_assert.h"
#include "gdb_string.h"
@@ -187,8 +188,8 @@ fill_fpregset (gdb_fpregset_t *fpregs, i
this for all registers (including the floating point and SSE
registers). */
-void
-fetch_inferior_registers (int regno)
+static void
+m32r_linux_fetch_inferior_registers (int regno)
{
int tid;
@@ -213,8 +214,8 @@ fetch_inferior_registers (int regno)
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-void
-store_inferior_registers (int regno)
+static void
+m32r_linux_store_inferior_registers (int regno)
{
int tid;
@@ -233,3 +234,21 @@ store_inferior_registers (int regno)
internal_error (__FILE__, __LINE__,
_("Got request to store bad register number %d."), regno);
}
+
+void _initialize_m32r_linux_nat (void);
+
+void
+_initialize_m32r_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = m32r_linux_fetch_inferior_registers;
+ t->to_store_registers = m32r_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: m68klinux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/m68klinux-nat.c,v
retrieving revision 1.28
diff -u -p -r1.28 m68klinux-nat.c
--- m68klinux-nat.c 11 Feb 2005 18:13:51 -0000 1.28
+++ m68klinux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
/* Motorola m68k native support for GNU/Linux.
- Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation,
- Inc.
+ Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,6 +27,8 @@
#include "gdbcore.h"
#include "gdb_string.h"
#include "regcache.h"
+#include "target.h"
+#include "linux-nat.h"
#include "m68k-tdep.h"
@@ -170,7 +172,7 @@ fetch_register (int regno)
If REGNO is negative, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */
-void
+static void
old_fetch_inferior_registers (int regno)
{
if (regno >= 0)
@@ -237,7 +239,7 @@ store_register (int regno)
If REGNO is negative, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */
-void
+static void
old_store_inferior_registers (int regno)
{
if (regno >= 0)
@@ -442,8 +444,8 @@ static void store_fpregs (int tid, int r
this for all registers (including the floating point and SSE
registers). */
-void
-fetch_inferior_registers (int regno)
+static void
+m68k_linux_fetch_inferior_registers (int regno)
{
int tid;
@@ -498,8 +500,8 @@ fetch_inferior_registers (int regno)
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-void
-store_inferior_registers (int regno)
+static void
+m68k_linux_store_inferior_registers (int regno)
{
int tid;
@@ -616,8 +618,22 @@ static struct core_fns linux_elf_core_fn
NULL /* next */
};
+void _initialize_m68k_linux_nat (void);
+
void
_initialize_m68k_linux_nat (void)
{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = m68k_linux_fetch_inferior_registers;
+ t->to_store_registers = m68k_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+
deprecated_add_core_fns (&linux_elf_core_fns);
}
Index: mips-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-linux-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 mips-linux-nat.c
--- mips-linux-nat.c 30 Oct 2004 22:54:40 -0000 1.9
+++ mips-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on MIPS processors.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,6 +21,8 @@
#include "defs.h"
#include "mips-tdep.h"
+#include "target.h"
+#include "linux-nat.h"
/* Pseudo registers can not be read. ptrace does not provide a way to
read (or set) MIPS_PS_REGNUM, and there's no point in reading or
@@ -62,3 +64,11 @@ mips_linux_cannot_store_register (int re
else
return 1;
}
+
+void _initialize_mips_linux_nat (void);
+
+void
+_initialize_mips_linux_nat (void)
+{
+ add_target (linux_target ());
+}
Index: ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.54
diff -u -p -r1.54 ppc-linux-nat.c
--- ppc-linux-nat.c 11 Feb 2005 18:13:51 -0000 1.54
+++ ppc-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
/* PPC GNU/Linux native support.
Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
+ 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,6 +27,8 @@
#include "gdbcore.h"
#include "regcache.h"
#include "gdb_assert.h"
+#include "target.h"
+#include "linux-nat.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -494,8 +496,8 @@ fetch_ppc_registers (int tid)
/* Fetch registers from the child process. Fetch all registers if
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */
-void
-fetch_inferior_registers (int regno)
+static void
+ppc_linux_fetch_inferior_registers (int regno)
{
/* Overload thread id onto process id */
int tid = TIDGET (inferior_ptid);
@@ -775,8 +777,8 @@ store_ppc_registers (int tid)
store_spe_register (tid, -1);
}
-void
-store_inferior_registers (int regno)
+static void
+ppc_linux_store_inferior_registers (int regno)
{
/* Overload thread id onto process id */
int tid = TIDGET (inferior_ptid);
@@ -883,3 +885,21 @@ fill_fpregset (gdb_fpregset_t *fpregsetp
right_fill_reg (tdep->ppc_fpscr_regnum, (fpp + 8 * 32));
}
}
+
+void _initialize_ppc_linux_nat (void);
+
+void
+_initialize_ppc_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = ppc_linux_fetch_inferior_registers;
+ t->to_store_registers = ppc_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: s390-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-nat.c,v
retrieving revision 1.13
diff -u -p -r1.13 s390-nat.c
--- s390-nat.c 11 Feb 2005 18:13:52 -0000 1.13
+++ s390-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,5 +1,5 @@
/* S390 native-dependent code for GDB, the GNU debugger.
- Copyright 2001, 2003 Free Software Foundation, Inc
+ Copyright 2001, 2003, 2004, 2005 Free Software Foundation, Inc
Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
for IBM Deutschland Entwicklung GmbH, IBM Corporation.
@@ -25,6 +25,8 @@
#include "tm.h"
#include "regcache.h"
#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"
#include "s390-tdep.h"
@@ -200,8 +202,8 @@ store_fpregs (int tid, int regnum)
/* Fetch register REGNUM from the child process. If REGNUM is -1, do
this for all registers. */
-void
-fetch_inferior_registers (int regnum)
+static void
+s390_linux_fetch_inferior_registers (int regnum)
{
int tid = s390_inferior_tid ();
@@ -216,8 +218,8 @@ fetch_inferior_registers (int regnum)
/* Store register REGNUM back into the child process. If REGNUM is
-1, do this for all registers. */
-void
-store_inferior_registers (int regnum)
+static void
+s390_linux_store_inferior_registers (int regnum)
{
int tid = s390_inferior_tid ();
@@ -357,3 +359,20 @@ kernel_u_size (void)
return sizeof (struct user);
}
+void _initialize_s390_nat (void);
+
+void
+_initialize_s390_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = s390_linux_fetch_inferior_registers;
+ t->to_store_registers = s390_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: sparc-linux-nat.c
===================================================================
RCS file: sparc-linux-nat.c
diff -N sparc-linux-nat.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sparc-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -0,0 +1,43 @@
+/* Native-dependent code for GNU/Linux SPARC.
+ Copyright 2005
+ Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"
+
+void _initialialize_sparc_linux_nat (void);
+
+void
+_initialize_sparc_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = fetch_inferior_registers;
+ t->to_store_registers = store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: sparc64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-linux-nat.c,v
retrieving revision 1.2
diff -u -p -r1.2 sparc64-linux-nat.c
--- sparc64-linux-nat.c 3 Jan 2004 10:08:44 -0000 1.2
+++ sparc64-linux-nat.c 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux UltraSPARC.
- Copyright 2003 Free Software Foundation, Inc.
+ Copyright 2003, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,6 +23,9 @@
#include "sparc64-tdep.h"
#include "sparc-nat.h"
+#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"
static const struct sparc_gregset sparc64_linux_ptrace_gregset =
{
@@ -44,5 +47,17 @@ void _initialize_sparc64_linux_nat (void
void
_initialize_sparc64_linux_nat (void)
{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = fetch_inferior_registers;
+ t->to_store_registers = store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+
sparc_gregset = &sparc64_linux_ptrace_gregset;
}
Index: config/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
retrieving revision 1.24
diff -u -p -r1.24 nm-linux.h
--- config/nm-linux.h 20 Sep 2004 16:39:34 -0000 1.24
+++ config/nm-linux.h 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,7 @@
/* Native support for GNU/Linux.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -42,11 +43,6 @@ struct target_ops;
#endif
\f
-/* Override child_wait in `inftarg.c'. */
-struct target_waitstatus;
-extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
-#define CHILD_WAIT
-
extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
@@ -58,17 +54,3 @@ extern void lin_thread_get_thread_signal
#define GDB_GREGSET_T elf_gregset_t
#define GDB_FPREGSET_T elf_fpregset_t
-
-/* Override child_pid_to_exec_file in 'inftarg.c'. */
-#define CHILD_PID_TO_EXEC_FILE
-
-#define CHILD_INSERT_FORK_CATCHPOINT
-#define CHILD_INSERT_VFORK_CATCHPOINT
-#define CHILD_INSERT_EXEC_CATCHPOINT
-#define CHILD_POST_STARTUP_INFERIOR
-#define CHILD_POST_ATTACH
-#define CHILD_FOLLOW_FORK
-#define DEPRECATED_KILL_INFERIOR
-
-#define NATIVE_XFER_AUXV procfs_xfer_auxv
-#include "auxv.h" /* Declares it. */
Index: config/alpha/alpha-linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/alpha/alpha-linux.mh,v
retrieving revision 1.17
diff -u -p -r1.17 alpha-linux.mh
--- config/alpha/alpha-linux.mh 14 Nov 2004 18:47:50 -0000 1.17
+++ config/alpha/alpha-linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
# Host: Little-endian Alpha running Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
+NATDEPFILES= inf-ptrace.o corelow.o alpha-nat.o alpha-linux-nat.o \
fork-child.o proc-service.o linux-thread-db.o gcore.o \
linux-nat.o
Index: config/arm/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/linux.mh,v
retrieving revision 1.15
diff -u -p -r1.15 linux.mh
--- config/arm/linux.mh 14 Nov 2004 18:47:51 -0000 1.15
+++ config/arm/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: ARM based machine running GNU/Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
core-regset.o arm-linux-nat.o gcore.o \
proc-service.o linux-thread-db.o linux-nat.o
Index: config/djgpp/fnchange.lst
===================================================================
RCS file: /cvs/src/src/gdb/config/djgpp/fnchange.lst,v
retrieving revision 1.92
diff -u -p -r1.92 fnchange.lst
--- config/djgpp/fnchange.lst 29 May 2005 07:36:09 -0000 1.92
+++ config/djgpp/fnchange.lst 4 Sep 2005 20:58:31 -0000
@@ -83,6 +83,8 @@
@V@/gdb/alphabsd-nat.c @V@/gdb/alphb-nat.c
@V@/gdb/alphabsd-tdep.c @V@/gdb/alphb-tdep.c
@V@/gdb/alphanbsd-tdep.c @V@/gdb/alphnb-tdep.c
+@V@/gdb/alpha-linux-nat.c @V@/gdb/alphl-nat.c
+@V@/gdb/alpha-linux-tdep.c @V@/gdb/alphl-tdep.c
@V@/gdb/arm-linux-nat.c @V@/gdb/armlin-nat.c
@V@/gdb/arm-linux-tdep.c @V@/gdb/armlin-tdep.c
@V@/gdb/armnbsd-nat.c @V@/gdb/armnbd-nat.c
@@ -201,6 +203,8 @@
@V@/gdb/sparc64-sol2-tdep.c @V@/gdb/sp64s2-tdep.c
@V@/gdb/sparcnbsd-nat.c @V@/gdb/spnb-nat.c
@V@/gdb/sparcnbsd-tdep.c @V@/gdb/spnb-tdep.c
+@V@/gdb/sparc-linux-nat.c @V@/gdb/splx-nat.c
+@V@/gdb/sparc-linux-tdep.c @V@/gdb/splx-tdep.c
@V@/gdb/sparc-sol2-nat.c @V@/gdb/spsol2-nat.c
@V@/gdb/sparc-sol2-tdep.c @V@/gdb/spsol2-tdep.c
@V@/gdb/testsuite/.gdbinit @V@/gdb/testsuite/gdb.ini
Index: config/i386/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux.mh,v
retrieving revision 1.17
diff -u -p -r1.17 linux.mh
--- config/i386/linux.mh 14 Nov 2004 18:47:51 -0000 1.17
+++ config/i386/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: Intel 386 running GNU/Linux.
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
core-aout.o i386-nat.o i386-linux-nat.o \
proc-service.o linux-thread-db.o gcore.o \
linux-nat.o
Index: config/i386/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux64.mh,v
retrieving revision 1.5
diff -u -p -r1.5 linux64.mh
--- config/i386/linux64.mh 14 Nov 2004 18:47:51 -0000 1.5
+++ config/i386/linux64.mh 4 Sep 2005 20:58:31 -0000
@@ -1,5 +1,5 @@
# Host: GNU/Linux x86-64
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
proc-service.o linux-thread-db.o gcore.o
NAT_FILE= nm-linux64.h
Index: config/i386/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v
retrieving revision 1.21
diff -u -p -r1.21 nm-linux.h
--- config/i386/nm-linux.h 20 Sep 2004 16:39:35 -0000 1.21
+++ config/i386/nm-linux.h 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,8 @@
/* Native support for GNU/Linux x86.
Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -79,16 +80,4 @@ extern int cannot_store_register (int re
#define FILL_FPXREGSET
#endif
-/* Override child_resume in `infptrace.c'. */
-#define DEPRECATED_CHILD_RESUME
-
-/* `linux-nat.c' and `i386-nat.c' have their own versions of
- child_post_startup_inferior. Define this to use the copy in
- `i386-linux-nat.c' instead, which calls both.
-
- NOTE drow/2003-08-17: This is ugly beyond words, but properly
- fixing it will require some serious surgery. Ideally the target
- stack could be used for this. */
-#define LINUX_CHILD_POST_STARTUP_INFERIOR
-
#endif /* nm-linux.h */
Index: config/i386/nm-linux64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux64.h,v
retrieving revision 1.2
diff -u -p -r1.2 nm-linux64.h
--- config/i386/nm-linux64.h 15 Aug 2004 16:10:23 -0000 1.2
+++ config/i386/nm-linux64.h 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native support for GNU/Linux x86-64.
- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
@@ -55,9 +55,4 @@ extern unsigned long amd64_linux_dr_get_
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS
-/* `linux-nat.c' and `i386-nat.c' have their own versions of
- child_post_startup_inferior. Define this to use the copy in
- `x86-86-linux-nat.c' instead, which calls both. */
-#define LINUX_CHILD_POST_STARTUP_INFERIOR
-
#endif /* nm-linux64.h */
Index: config/ia64/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/linux.mh,v
retrieving revision 1.18
diff -u -p -r1.18 linux.mh
--- config/ia64/linux.mh 14 Nov 2004 18:47:51 -0000 1.18
+++ config/ia64/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: Intel IA-64 running GNU/Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
core-aout.o core-regset.o ia64-linux-nat.o \
proc-service.o linux-thread-db.o linux-nat.o
Index: config/ia64/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/nm-linux.h,v
retrieving revision 1.16
diff -u -p -r1.16 nm-linux.h
--- config/ia64/nm-linux.h 8 Oct 2004 17:30:48 -0000 1.16
+++ config/ia64/nm-linux.h 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
/* Native support for GNU/Linux, for GDB, the GNU debugger.
- Copyright 1999, 2000, 2001, 2004
+ Copyright 1999, 2000, 2001, 2004, 2005
Free Software Foundation, Inc.
This file is part of GDB.
@@ -75,15 +75,4 @@ extern int ia64_linux_insert_watchpoint
extern int ia64_linux_remove_watchpoint (ptid_t ptid, CORE_ADDR addr,
int len);
-#include "target.h"
-
-#define NATIVE_XFER_UNWIND_TABLE ia64_linux_xfer_unwind_table
-extern LONGEST ia64_linux_xfer_unwind_table (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- void *readbuf,
- const void *writebuf,
- ULONGEST offset,
- LONGEST len);
-
#endif /* #ifndef NM_LINUX_H */
Index: config/m32r/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m32r/linux.mh,v
retrieving revision 1.2
diff -u -p -r1.2 linux.mh
--- config/m32r/linux.mh 14 Nov 2004 18:47:51 -0000 1.2
+++ config/m32r/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: M32R based machine running GNU/Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
m32r-linux-nat.o gcore.o proc-service.o linux-thread-db.o \
linux-nat.o
Index: config/m68k/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/linux.mh,v
retrieving revision 1.16
diff -u -p -r1.16 linux.mh
--- config/m68k/linux.mh 14 Nov 2004 18:47:51 -0000 1.16
+++ config/m68k/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: Motorola m68k running GNU/Linux.
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
corelow.o core-aout.o m68klinux-nat.o gcore.o \
proc-service.o linux-thread-db.o linux-nat.o
Index: config/mips/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/linux.mh,v
retrieving revision 1.9
diff -u -p -r1.9 linux.mh
--- config/mips/linux.mh 14 Nov 2004 18:47:51 -0000 1.9
+++ config/mips/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,6 +1,6 @@
# Host: Linux/MIPS
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o mips-linux-nat.o \
+NATDEPFILES= inf-ptrace.o fork-child.o mips-linux-nat.o \
linux-thread-db.o proc-service.o gcore.o \
linux-nat.o
Index: config/pa/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/linux.mh,v
retrieving revision 1.5
diff -u -p -r1.5 linux.mh
--- config/pa/linux.mh 14 Nov 2004 18:47:51 -0000 1.5
+++ config/pa/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,7 +1,7 @@
# Host: Hewlett-Packard PA-RISC machine, running Linux
XDEPFILES=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
core-regset.o hppa-linux-nat.o \
proc-service.o linux-thread-db.o linux-nat.o
Index: config/powerpc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/linux.mh,v
retrieving revision 1.18
diff -u -p -r1.18 linux.mh
--- config/powerpc/linux.mh 14 Nov 2004 18:47:51 -0000 1.18
+++ config/powerpc/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -3,7 +3,7 @@
XM_CLIBS=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
ppc-linux-nat.o proc-service.o linux-thread-db.o \
gcore.o linux-nat.o
Index: config/powerpc/ppc64-linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/ppc64-linux.mh,v
retrieving revision 1.7
diff -u -p -r1.7 ppc64-linux.mh
--- config/powerpc/ppc64-linux.mh 14 Nov 2004 18:47:51 -0000 1.7
+++ config/powerpc/ppc64-linux.mh 4 Sep 2005 20:58:31 -0000
@@ -3,7 +3,7 @@
XM_CLIBS=
NAT_FILE= nm-ppc64-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
ppc-linux-nat.o proc-service.o linux-thread-db.o \
gcore.o linux-nat.o
Index: config/s390/s390.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/s390/s390.mh,v
retrieving revision 1.12
diff -u -p -r1.12 s390.mh
--- config/s390/s390.mh 14 Nov 2004 18:47:52 -0000 1.12
+++ config/s390/s390.mh 4 Sep 2005 20:58:31 -0000
@@ -1,5 +1,5 @@
# Host: S390, running Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o s390-nat.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o s390-nat.o \
gcore.o linux-thread-db.o proc-service.o linux-nat.o
LOADLIBES = -ldl -rdynamic
Index: config/sparc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux.mh,v
retrieving revision 1.15
diff -u -p -r1.15 linux.mh
--- config/sparc/linux.mh 14 Nov 2004 18:47:52 -0000 1.15
+++ config/sparc/linux.mh 4 Sep 2005 20:58:31 -0000
@@ -1,8 +1,7 @@
# Host: GNU/Linux SPARC
NAT_FILE= nm-linux.h
-NATDEPFILES= sparc-nat.o sparc-sol2-nat.o \
+NATDEPFILES= sparc-nat.o sparc-sol2-nat.o sparc-linux-nat.o \
corelow.o core-regset.o fork-child.o inf-ptrace.o \
- infptrace.o inftarg.o \
proc-service.o linux-thread-db.o \
gcore.o linux-nat.o
Index: config/sparc/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux64.mh,v
retrieving revision 1.6
diff -u -p -r1.6 linux64.mh
--- config/sparc/linux64.mh 14 Nov 2004 18:47:52 -0000 1.6
+++ config/sparc/linux64.mh 4 Sep 2005 20:58:31 -0000
@@ -2,7 +2,7 @@
NAT_FILE= nm-linux.h
NATDEPFILES= sparc-nat.o sparc64-nat.o sparc-sol2-nat.o sparc64-linux-nat.o \
corelow.o core-regset.o \
- fork-child.o inf-ptrace.o infptrace.o inftarg.o \
+ fork-child.o inf-ptrace.o \
proc-service.o linux-thread-db.o \
gcore.o linux-nat.o
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC/RFA] Target vectors for native Linux targets
2005-09-04 22:48 ` Daniel Jacobowitz
@ 2005-09-05 17:32 ` Ulrich Weigand
2005-09-10 18:13 ` Daniel Jacobowitz
0 siblings, 1 reply; 14+ messages in thread
From: Ulrich Weigand @ 2005-09-05 17:32 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Ulrich Weigand, Mark Kettenis, manjo, gdb-patches
Daniel Jacobowitz wrote:
>I'm presenting an alternative patch, stealing bits from mine last
>December and other clever bits from Ulrich's. His patch was much
>prettier than mine - but missed some important things that generated
>ugliness in my first patch (for instance non-FETCH_INFERIOR_REGISTERS
>targets). I've come up with cleaner solutions than I did the first
>time round.
Thanks for looking into this again!
> On Fri, Aug 19, 2005 at 02:51:24AM +0200, Ulrich Weigand wrote:
> > One problem with the conversion is that I wouldn't want to have to
> > convert all the various Linux subtargets at the same time. It's a
> > lot of work, and I'm unable to test most of those platforms. Thus
> > I've thought of a way to stage the conversion:
>
> I bit the bullet and did them all, since I had most of it lying around
> anyway.
Excellent ;-)
> This patch has only been tested on i686-pc-linux-gnu at the moment, but
> it's been mightily proofread, and I have high confidence in it. It
> obsoletes about half your posted patch for S/390 (the watchpoint bits
> are an obvious follow-up). Could you give this a spin on S/390 for me?
Your patch works fine with no regressions on s390-ibm-linux and
s390x-ibm-linux. I'll be happy to do the watchpoint bits once
your patch is committed ...
> + /* FIXME drow/2005-09-04: The hardcoded use of register_addr should go
> + away. This requires disentangling the various definitions of it
> + (particularly alpha-nat.c's). */
> +#ifdef FETCH_INFERIOR_REGISTERS
> + t = inf_ptrace_target ();
> +#else
> + t = inf_ptrace_trad_target (register_addr);
> +#endif
This means FETCH_INFERIOR_REGISTERS needs to be kept around in various
nm-linux.h files for now? I'd have hoped to get rid of at least the
s390 variant ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC/RFA] Target vectors for native Linux targets
2005-09-05 17:32 ` Ulrich Weigand
@ 2005-09-10 18:13 ` Daniel Jacobowitz
2005-09-11 22:02 ` [committed] s390 watchpoints (Re: [RFC/RFA] Target vectors for native Linux targets) Ulrich Weigand
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2005-09-10 18:13 UTC (permalink / raw)
To: Ulrich Weigand
Cc: Mark Kettenis, manjo, gdb-patches, Jeff Johnston, David Mosberger
On Mon, Sep 05, 2005 at 07:31:59PM +0200, Ulrich Weigand wrote:
> Daniel Jacobowitz wrote:
> > This patch has only been tested on i686-pc-linux-gnu at the moment, but
> > it's been mightily proofread, and I have high confidence in it. It
> > obsoletes about half your posted patch for S/390 (the watchpoint bits
> > are an obvious follow-up). Could you give this a spin on S/390 for me?
>
> Your patch works fine with no regressions on s390-ibm-linux and
> s390x-ibm-linux. I'll be happy to do the watchpoint bits once
> your patch is committed ...
Good enough for me. I checked x86_64-pc-linux-gnu too - also fine.
I foolishly decided to also check ia64, since that was the most picky
of the bunch when I originally wrote this. Test results even without
the patch are dismal (see gdb@ today for more, threading is completely
broken).
And it doesn't build with the patch, because ia64-tdep.c now directly
calls the native Linux code and uses syscall() in order to get unwind
information for core files.
Jeff, David, this comes from your 2005-06-08 patch to improve libunwind
support. It's not OK. For one thing, you can no longer use libunwind
to compile an ia64-linux targetted gdb from x86_64-linux.
I am temporarily reverting that bit of your patch with an informative
comment. Has there been any progress on getting the necessary data
into core files? Assuming not, then we need to do this:
/* FIXME drow/2005-09-10: This code used to call
ia64_linux_xfer_unwind_table directly to fetch the unwind table
for the currently running ia64-linux kernel. That data should
come from the core file and be accessed via the auxv vector; if
we want to preserve fall back to the running kernel's table, then
we should find a way to override the corefile layer's
xfer_partial method. */
[Aside: In fact you can't build that configuration anyway, but that's
due to an unrelated configury problem: a cross libunwind does not
install libunwind.h, only libunwind-ia64.h. But libunwind-frame.*
use libunwind.h. With the appropriate symlink, I get the expected
linker error for ia64_linux_xfer_unwind_table. And with my patch
I can build GDB again. Whew.]
I also found a couple of bugs in my changes, though, so I'm glad I
tried. I lost an important "static" qualifier on super_xfer_partial,
and misused the register_u_offset argument to inf_ptrace_trad_target,
for instance. A couple of others.
With the fixed patch the ia64 single-threaded test results seem
basically unchanged, which is good. So I didn't break libunwind for
the native case.
> > + /* FIXME drow/2005-09-04: The hardcoded use of register_addr should go
> > + away. This requires disentangling the various definitions of it
> > + (particularly alpha-nat.c's). */
> > +#ifdef FETCH_INFERIOR_REGISTERS
> > + t = inf_ptrace_target ();
> > +#else
> > + t = inf_ptrace_trad_target (register_addr);
> > +#endif
>
> This means FETCH_INFERIOR_REGISTERS needs to be kept around in various
> nm-linux.h files for now? I'd have hoped to get rid of at least the
> s390 variant ...
Yes, that's right - for the moment.
Here's what I'm checking in, in the interests of progress. I'll be
glad to help with any problems it causes, including the ia64 corefile
issue.
--
Daniel Jacobowitz
CodeSourcery, LLC
2005-09-10 Daniel Jacobowitz <dan@codesourcery.com>
Ulrich Weigand <uweigand@de.ibm.com>
* Makefile.in (ALLDEPFILES): Update.
(alpha-linux-nat.o, sparc-linux-nat.o): New rules.
(amd64-linux-nat.o, arm-linux-nat.o, hppa-linux-nat.o)
(i386-linux-nat.o, ia64-linux-nat.o, linux-nat.o, m32r-linux-nat.o)
(m68klinux-nat.o, mips-linux-nat.o, ppc-linux-nat.o, s390-nat.o)
(sparc64-linux-nat.o): Update dependencies.
* alpha-linux-nat.c, sparc-linux-nat.c: New files.
* amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(amd64_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(amd64_linux_child_post_start_inferior): Renamed from
child_post_startup_inferior and made static. Call
super_post_startup_inferior.
(super_post_startup_inferior): New.
(_initialize_amd64_linux_nat): Set it. Call linux_target and
add_target.
* arm-linux-nat.c (arm_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(arm_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_arm_linux_nat): Add a prototype. Use linux_target and
add_target.
* hppa-linux-nat.c (hppa_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(hppa_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_hppa_linux_nat): New function.
* i386-linux-nat.c (i386_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(i386_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(i386_linux_resume): Renamed from child_resume and made static.
(i386_linux_child_post_start_inferior): Renamed from
child_post_startup_inferior and made static. Call
super_post_startup_inferior.
(super_post_startup_inferior): New.
(_initialize_i386_linux_nat): New function.
* i386-nat.c: Remove LINUX_CHILD_POST_STARTUP_INFERIOR #ifndef.
* ia64-linux-nat.c (ia64_linux_xfer_unwind_table): Remove.
(super_xfer_partial): New.
(ia64_linux_xfer_partial): New function. Use it.
(_initialize_ia64_linux_nat): New function.
* ia64-tdep.c (getunwind_table): Revert 2005-06-08 change; use
target_read_partial and document the problem.
* inf-ptrace.c (inf_ptrace_fetch_register): Use
CANNOT_FETCH_REGISTER. Fix some comments.
(inf_ptrace_store_register): Use CANNOT_STORE_REGISTER. Fix some
comments.
* linux-nat.c: Include "inf-ptrace.h" and "auxv.h".
(linux_ops, super_xfer_partial): New variables.
(linux_child_post_startup_inferior): Make static.
(child_post_startup_inferior): Delete.
(linux_nat_attach, linux_nat_detach, resume_callback)
(linux_nat_resume, linux_nat_wait, linux_nat_create_inferior)
(linux_nat_mourn_inferior): Use linux_ops instead of
deprecated_child_ops.
(child_wait): Do not depend on CHILD_WAIT.
(linux_nat_xfer_memory): Remove, replace by ...
(linux_nat_xfer_partial): ... this. Use linux_ops->to_xfer_partial
instead of linux_proc_xfer_memory and child_xfer_memory.
(linux_nat_fetch_registers, linux_nat_store_registers)
(linux_nat_child_post_startup_inferior): New functions.
(init_linux_nat_ops): Use the new functions.
(linux_proc_xfer_memory): Remove, replace by ...
(linux_proc_xfer_partial): ... this. Make static.
(linux_xfer_partial, linux_register_u_offset, linux_target): New
functions.
(_initialize_linux_nat): Do not modify deprecated_child_ops.
* linux-nat.h (linux_proc_xfer_memory): Remove prototype.
(struct mem_attrib, struct target_ops): Remove forward declarations.
(linux_child_post_startup_inferior): Remove prototype.
(linux_target): Add prototype.
* linux-thread-db.c (thread_db_xfer_memory): Remove, replace by ...
(thread_db_xfer_partial): ... this.
(init_thread_db_ops): Set to_xfer_partial instead of
deprecated_xfer_memory.
* m32r-linux-nat.c (m32r_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(m32r_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_m32r_linux_nat): New function.
* m68klinux-nat.c (m68k_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(m68k_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(old_fetch_inferior_registers, old_store_inferior_registers): Made
static.
(_initialize_m68k_linux_nat): Use linux_target and add_target.
* mips-linux-nat.c (_initialize_mips_linux_nat): New function.
* ppc-linux-nat.c (ppc_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(ppc_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_ppc_linux_nat): New function.
* s390-nat.c (s390_linux_fetch_inferior_registers): Renamed
from fetch_inferior_registers and made static.
(s390_linux_store_inferior_registers): Renamed from
store_inferior_registers and made static.
(_initialize_s390_nat): New function.
* sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Use
linux_target and add_target.
* config/nm-linux.h: Don't include "auxv.h".
(struct target_waitstatus, child_wait, CHILD_WAIT)
(CHILD_PID_TO_EXEC_FILE, CHILD_INSERT_FORK_CATCHPOINT)
(CHILD_INSERT_VFORK_CATCHPOINT, CHILD_INSERT_EXEC_CATCHPOINT)
(CHILD_POST_STARTUP_INFERIOR, CHILD_POST_ATTACH, CHILD_FOLLOW_FORK)
(DEPRECATED_KILL_INFERIOR, NATIVE_XFER_AUXV): Delete.
* config/alpha/alpha-linux.mh (NATDEPFILES): Replace infptrace.o
and inftarg.o with inf-ptrace.o and alpha-linux-nat.o.
* config/sparc/linux.mh (NATDEPFILES): Replace infptrace.o and
inftarg.o with sparc-linux-nat.o.
* config/sparc/linux64.mh (NATDEPFILES): Remove infptrace.o and
inftarg.o.
* config/arm/linux.mh (NATDEPFILES): Replace infptrace.o and
inftarg.o with inf-ptrace.o.
* config/i386/linux.mh (NATDEPFILES): Likewise.
* config/i386/linux64.mh (NATDEPFILES): Likewise.
* config/ia64/linux.mh (NATDEPFILES): Likewise.
* config/m32r/linux.mh (NATDEPFILES): Likewise.
* config/m68k/linux.mh (NATDEPFILES): Likewise.
* config/mips/linux.mh (NATDEPFILES): Likewise.
* config/pa/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/linux.mh (NATDEPFILES): Likewise.
* config/powerpc/ppc64-linux.mh (NATDEPFILES): Likewise.
* config/s390/s390.mh (NATDEPFILES): Likewise.
* config/i386/nm-linux.h (DEPRECATED_CHILD_RESUME): Don't define.
(LINUX_CHILD_POST_STARTUP_INFERIOR): Don't define.
* config/i386/nm-linux64.h (LINUX_CHILD_POST_STARTUP_INFERIOR):
Don't define.
* config/ia64/nm-linux.h: Don't include "target.h".
(NATIVE_XFER_UNWIND_TABLE, ia64_linux_xfer_unwind_table): Remove.
* config/djgpp/fnchange.lst: Add alpha-linux-tdep.c,
alpha-linux-nat.c, sparc-linux-tdep.c, and sparc-linux-nat.c.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.752
diff -u -p -r1.752 Makefile.in
--- Makefile.in 6 Sep 2005 23:14:44 -0000 1.752
+++ Makefile.in 10 Sep 2005 18:01:06 -0000
@@ -1374,7 +1374,7 @@ MAKEOVERRIDES=
ALLDEPFILES = \
aix-thread.c \
- alpha-nat.c alphabsd-nat.c \
+ alpha-nat.c alphabsd-nat.c alpha-linux-nat.c \
alpha-tdep.c alpha-linux-tdep.c alphabsd-tdep.c alphanbsd-tdep.c \
alpha-osf1-tdep.c alphafbsd-tdep.c alpha-mdebug-tdep.c \
amd64-nat.c amd64-tdep.c \
@@ -1416,6 +1416,7 @@ ALLDEPFILES = \
m32r-linux-nat.c m32r-linux-tdep.c \
m68k-tdep.c \
m68kbsd-nat.c m68kbsd-tdep.c \
+ m68klinux-nat.c m68klinux-tdep.c \
m88k-tdep.c m88kbsd-nat.c \
mcore-tdep.c \
mips-linux-nat.c mips-linux-tdep.c \
@@ -1439,6 +1440,7 @@ ALLDEPFILES = \
ser-go32.c ser-pipe.c ser-tcp.c \
sh-tdep.c sh64-tdep.c shnbsd-tdep.c shnbsd-nat.c \
solib-irix.c solib-svr4.c solib-sunos.c \
+ sparc-linux-nat.c \
sparc-linux-tdep.c sparc-nat.c sparc-sol2-nat.c sparc-sol2-tdep.c \
sparc-tdep.c sparc-sol2-nat.c sparc-sol2-tdep.c sparc64-linux-nat.c \
sparc64-linux-tdep.c sparc64-nat.c sparc64-sol2-tdep.c \
@@ -1669,6 +1671,7 @@ alphabsd-tdep.o: alphabsd-tdep.c $(defs_
$(alphabsd_tdep_h)
alphafbsd-tdep.o: alphafbsd-tdep.c $(defs_h) $(value_h) $(osabi_h) \
$(alpha_tdep_h)
+alpha-linux-nat.o: alpha-linux-nat.c $(defs_h) $(target_h) $(linux_nat_h)
alpha-linux-tdep.o: alpha-linux-tdep.c $(defs_h) $(frame_h) $(gdb_assert_h) \
$(osabi_h) $(solib_svr4_h) $(alpha_tdep_h)
alpha-mdebug-tdep.o: alpha-mdebug-tdep.c $(defs_h) $(frame_h) \
@@ -1699,7 +1702,7 @@ amd64fbsd-tdep.o: amd64fbsd-tdep.c $(def
amd64-linux-nat.o: amd64-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
$(gdb_proc_service_h) $(gregset_h) $(amd64_tdep_h) \
- $(i386_linux_tdep_h) $(amd64_nat_h)
+ $(i386_linux_tdep_h) $(amd64_nat_h) $(target_h)
amd64-linux-tdep.o: amd64-linux-tdep.c $(defs_h) $(frame_h) $(gdbcore_h) \
$(regcache_h) $(osabi_h) $(symtab_h) $(gdb_string_h) $(amd64_tdep_h) \
$(solib_svr4_h)
@@ -1732,7 +1735,8 @@ arch-utils.o: arch-utils.c $(defs_h) $(a
$(gdb_assert_h) $(sim_regno_h) $(gdbcore_h) $(osabi_h) $(version_h) \
$(floatformat_h)
arm-linux-nat.o: arm-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
- $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h)
+ $(gdb_string_h) $(regcache_h) $(arm_tdep_h) $(gregset_h) \
+ $(target_h) $(linux_nat_h)
arm-linux-tdep.o: arm-linux-tdep.c $(defs_h) $(target_h) $(value_h) \
$(gdbtypes_h) $(floatformat_h) $(gdbcore_h) $(frame_h) $(regcache_h) \
$(doublest_h) $(solib_svr4_h) $(osabi_h) $(arm_tdep_h) \
@@ -2013,7 +2017,8 @@ hppa-hpux-tdep.o: hppa-hpux-tdep.c $(def
$(hppa_tdep_h) $(solib_som_h) $(solib_pa64_h) $(regset_h) \
$(exceptions_h) $(gdb_string_h)
hppa-linux-nat.o: hppa-linux-nat.c $(defs_h) $(gdbcore_h) $(regcache_h) \
- $(gdb_string_h) $(inferior_h) $(hppa_tdep_h) $(gregset_h)
+ $(gdb_string_h) $(inferior_h) $(hppa_tdep_h) $(gregset_h) \
+ $(target_h) $(linux_nat_h)
hppa-linux-tdep.o: hppa-linux-tdep.c $(defs_h) $(gdbcore_h) $(osabi_h) \
$(target_h) $(objfiles_h) $(solib_svr4_h) $(glibc_tdep_h) \
$(frame_unwind_h) $(trad_frame_h) $(dwarf2_frame_h) $(value_h) \
@@ -2050,7 +2055,7 @@ i386gnu-tdep.o: i386gnu-tdep.c $(defs_h)
i386-linux-nat.o: i386-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
$(gregset_h) $(i387_tdep_h) $(i386_tdep_h) $(i386_linux_tdep_h) \
- $(gdb_proc_service_h)
+ $(gdb_proc_service_h) $(target_h)
i386-linux-tdep.o: i386-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
$(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
$(dwarf2_frame_h) $(gdb_string_h) $(i386_tdep_h) \
@@ -2092,7 +2097,7 @@ i387-tdep.o: i387-tdep.c $(defs_h) $(dou
$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(i387_tdep_h)
ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \
$(target_h) $(gdbcore_h) $(regcache_h) $(ia64_tdep_h) $(gdb_wait_h) \
- $(gregset_h)
+ $(gregset_h) $(linux_nat_h)
ia64-linux-tdep.o: ia64-linux-tdep.c $(defs_h) $(ia64_tdep_h) \
$(arch_utils_h) $(gdbcore_h) $(regcache_h) $(osabi_h) $(solib_svr4_h)
ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(gdbcore_h) \
@@ -2174,8 +2179,8 @@ linespec.o: linespec.c $(defs_h) $(symta
$(objc_lang_h) $(linespec_h) $(exceptions_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) $(elf_bfd_h) $(gregset_h) $(gdbcore_h) \
- $(gdbthread_h) $(gdb_stat_h)
+ $(gdbcmd_h) $(regcache_h) $(inf_ptrace.h) $(auxv.h) $(elf_bfd_h) \
+ $(gregset_h) $(gdbcore_h) $(gdbthread_h) $(gdb_stat_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) \
$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \
@@ -2194,7 +2199,7 @@ m2-valprint.o: m2-valprint.c $(defs_h) $
$(m2_lang_h) $(c_lang_h)
m32r-linux-nat.o: m32r-linux-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \
$(regcache_h) $(linux_nat_h) $(gdb_assert_h) $(gdb_string_h) \
- $(gregset_h) $(m32r_tdep_h)
+ $(gregset_h) $(m32r_tdep_h) $(target_h)
m32r-linux-tdep.o: m32r-linux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \
$(value_h) $(regcache_h) $(inferior_h) $(osabi_h) $(reggroups_h) \
$(regset_h) $(gdb_string_h) $(glibc_tdep_h) $(solib_svr4_h) \
@@ -2225,7 +2230,7 @@ m68kbsd-tdep.o: m68kbsd-tdep.c $(defs_h)
m68klinux-nat.o: m68klinux-nat.c $(defs_h) $(frame_h) $(inferior_h) \
$(language_h) $(gdbcore_h) $(gdb_string_h) $(regcache_h) \
$(m68k_tdep_h) $(gdb_stat_h) $(floatformat_h) $(target_h) \
- $(gregset_h)
+ $(gregset_h) $(target_h) $(linux_nat_h)
m68klinux-tdep.o: m68klinux-tdep.c $(defs_h) $(gdbcore_h) $(doublest_h) \
$(floatformat_h) $(frame_h) $(target_h) $(gdb_string_h) \
$(gdbtypes_h) $(osabi_h) $(regcache_h) $(objfiles_h) $(symtab_h) \
@@ -2276,7 +2281,8 @@ mips64obsd-tdep.o: mips64obsd-tdep.c $(d
$(regset_h) $(trad_frame_h) $(tramp_frame_h) $(gdb_assert_h) \
$(gdb_string_h) $(mips_tdep_h) $(solib_svr4_h)
mips-irix-tdep.o: mips-irix-tdep.c $(defs_h) $(osabi_h) $(elf_bfd_h)
-mips-linux-nat.o: mips-linux-nat.c $(defs_h) $(mips_tdep_h)
+mips-linux-nat.o: mips-linux-nat.c $(defs_h) $(mips_tdep_h) $(target_h) \
+ $(linux_nat_h)
mips-linux-tdep.o: mips-linux-tdep.c $(defs_h) $(gdbcore_h) $(target_h) \
$(solib_svr4_h) $(osabi_h) $(mips_tdep_h) $(gdb_string_h) \
$(gdb_assert_h) $(frame_h) $(regcache_h) $(trad_frame_h) \
@@ -2369,7 +2375,8 @@ ppcbug-rom.o: ppcbug-rom.c $(defs_h) $(g
$(serial_h) $(regcache_h)
ppc-linux-nat.o: ppc-linux-nat.c $(defs_h) $(gdb_string_h) $(frame_h) \
$(inferior_h) $(gdbcore_h) $(regcache_h) $(gdb_assert_h) \
- $(gdb_wait_h) $(gregset_h) $(ppc_tdep_h)
+ $(gdb_wait_h) $(gregset_h) $(ppc_tdep_h) $(target_h) \
+ $(linux_nat_h)
ppc-linux-tdep.o: ppc-linux-tdep.c $(defs_h) $(frame_h) $(inferior_h) \
$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(symfile_h) \
$(objfiles_h) $(regcache_h) $(value_h) $(osabi_h) $(regset_h) \
@@ -2480,7 +2487,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $
$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
$(frame_unwind_h) $(frame_base_h) $(reggroups_h)
s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
- $(s390_tdep_h)
+ $(s390_tdep_h) $(target_h) $(linux_nat_h)
s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) \
$(tm_h) $(__bfd_bfd_h) $(floatformat_h) $(regcache_h) \
@@ -2580,7 +2587,7 @@ sparc64fbsd-tdep.o: sparc64fbsd-tdep.c $
$(target_h) $(trad_frame_h) $(gdb_assert_h) $(gdb_string_h) \
$(sparc64_tdep_h) $(solib_svr4_h)
sparc64-linux-nat.o: sparc64-linux-nat.c $(defs_h) $(sparc64_tdep_h) \
- $(sparc_nat_h)
+ $(sparc_nat_h) $(inferior_h) $(target_h) $(linux_nat_h)
sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(frame_h) \
$(frame_unwind_h) $(gdbarch_h) $(osabi_h) $(solib_svr4_h) \
$(symtab_h) $(trad_frame_h) $(tramp_frame_h) $(sparc64_tdep_h)
@@ -2603,6 +2610,8 @@ sparc64-tdep.o: sparc64-tdep.c $(defs_h)
$(gdbcore_h) $(gdbtypes_h) $(inferior_h) $(symtab_h) $(objfiles_h) \
$(osabi_h) $(regcache_h) $(target_h) $(value_h) $(gdb_assert_h) \
$(gdb_string_h) $(sparc64_tdep_h)
+sparc-linux-nat.o: sparc-linux-nat.c $(defs_h) $(inferior_h) $(target_h) \
+ $(linux_nat_h)
sparc-linux-tdep.o: sparc-linux-tdep.c $(defs_h) $(floatformat_h) $(frame_h) \
$(frame_unwind_h) $(gdbarch_h) $(gdbcore_h) $(osabi_h) $(regcache_h) \
$(solib_svr4_h) $(symtab_h) $(trad_frame_h) $(tramp_frame_h) \
Index: alpha-linux-nat.c
===================================================================
RCS file: alpha-linux-nat.c
diff -N alpha-linux-nat.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ alpha-linux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -0,0 +1,32 @@
+/* Low level Alpha GNU/Linux interface, for GDB when running native.
+ Copyright 2005
+ Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "target.h"
+#include "linux-nat.h"
+
+void _initialialize_alpha_linux_nat (void);
+
+void
+_initialize_alpha_linux_nat (void)
+{
+ add_target (linux_target ());
+}
Index: amd64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 amd64-linux-nat.c
--- amd64-linux-nat.c 5 Jan 2005 15:43:42 -0000 1.9
+++ amd64-linux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux x86-64.
- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
This file is part of GDB.
@@ -147,8 +147,8 @@ fill_fpregset (elf_fpregset_t *fpregsetp
this for all registers (including the floating point and SSE
registers). */
-void
-fetch_inferior_registers (int regnum)
+static void
+amd64_linux_fetch_inferior_registers (int regnum)
{
int tid;
@@ -184,8 +184,8 @@ fetch_inferior_registers (int regnum)
-1, do this for all registers (including the floating-point and SSE
registers). */
-void
-store_inferior_registers (int regnum)
+static void
+amd64_linux_store_inferior_registers (int regnum)
{
int tid;
@@ -360,11 +360,13 @@ ps_get_thread_area (const struct ps_proc
}
\f
-void
-child_post_startup_inferior (ptid_t ptid)
+static void (*super_post_startup_inferior) (ptid_t ptid);
+
+static void
+amd64_linux_child_post_startup_inferior (ptid_t ptid)
{
i386_cleanup_dregs ();
- linux_child_post_startup_inferior (ptid);
+ super_post_startup_inferior (ptid);
}
\f
@@ -374,6 +376,8 @@ void _initialize_amd64_linux_nat (void);
void
_initialize_amd64_linux_nat (void)
{
+ struct target_ops *t;
+
amd64_native_gregset32_reg_offset = amd64_linux_gregset32_reg_offset;
amd64_native_gregset32_num_regs = I386_LINUX_NUM_REGS;
amd64_native_gregset64_reg_offset = amd64_linux_gregset64_reg_offset;
@@ -382,4 +386,18 @@ _initialize_amd64_linux_nat (void)
== amd64_native_gregset32_num_regs);
gdb_assert (ARRAY_SIZE (amd64_linux_gregset64_reg_offset)
== amd64_native_gregset64_num_regs);
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Override the GNU/Linux inferior startup hook. */
+ super_post_startup_inferior = t->to_post_startup_inferior;
+ t->to_post_startup_inferior = amd64_linux_child_post_startup_inferior;
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = amd64_linux_fetch_inferior_registers;
+ t->to_store_registers = amd64_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
}
Index: arm-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-nat.c,v
retrieving revision 1.23
diff -u -p -r1.23 arm-linux-nat.c
--- arm-linux-nat.c 29 Mar 2005 16:58:23 -0000 1.23
+++ arm-linux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -1,5 +1,6 @@
/* GNU/Linux on ARM native support.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,6 +24,8 @@
#include "gdbcore.h"
#include "gdb_string.h"
#include "regcache.h"
+#include "target.h"
+#include "linux-nat.h"
#include "arm-tdep.h"
@@ -547,8 +550,8 @@ store_regs (void)
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */
-void
-fetch_inferior_registers (int regno)
+static void
+arm_linux_fetch_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -569,8 +572,8 @@ fetch_inferior_registers (int regno)
regno == -1, otherwise store all general registers or all floating
point registers depending upon the value of regno. */
-void
-store_inferior_registers (int regno)
+static void
+arm_linux_store_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -716,8 +719,22 @@ get_linux_version (unsigned int *vmajor,
return ((*vmajor << 16) | (*vminor << 8) | *vrelease);
}
+void _initialize_arm_linux_nat (void);
+
void
_initialize_arm_linux_nat (void)
{
+ struct target_ops *t;
+
os_version = get_linux_version (&os_major, &os_minor, &os_release);
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = arm_linux_fetch_inferior_registers;
+ t->to_store_registers = arm_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
}
Index: hppa-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-linux-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 hppa-linux-nat.c
--- hppa-linux-nat.c 11 Feb 2005 04:05:50 -0000 1.9
+++ hppa-linux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -1,6 +1,6 @@
/* Functions specific to running GDB native on HPPA running GNU/Linux.
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,6 +24,8 @@
#include "regcache.h"
#include "gdb_string.h"
#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"
#include <sys/procfs.h>
#include <sys/ptrace.h>
@@ -267,8 +269,8 @@ store_register (int regno)
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */
-void
-fetch_inferior_registers (int regno)
+static void
+hppa_linux_fetch_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -285,8 +287,8 @@ fetch_inferior_registers (int regno)
regno == -1, otherwise store all general registers or all floating
point registers depending upon the value of regno. */
-void
-store_inferior_registers (int regno)
+static void
+hppa_linux_store_inferior_registers (int regno)
{
if (-1 == regno)
{
@@ -374,3 +376,21 @@ fill_fpregset (gdb_fpregset_t *fpregsetp
regcache_raw_collect (current_regcache, i, to);
}
}
+
+void _initialize_hppa_linux_nat (void);
+
+void
+_initialize_hppa_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = arm_linux_fetch_inferior_registers;
+ t->to_store_registers = arm_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: i386-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
retrieving revision 1.66
diff -u -p -r1.66 i386-linux-nat.c
--- i386-linux-nat.c 13 Aug 2005 22:03:46 -0000 1.66
+++ i386-linux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -24,6 +24,7 @@
#include "inferior.h"
#include "gdbcore.h"
#include "regcache.h"
+#include "target.h"
#include "linux-nat.h"
#include "gdb_assert.h"
@@ -480,8 +481,8 @@ cannot_store_register (int regno)
this for all registers (including the floating point and SSE
registers). */
-void
-fetch_inferior_registers (int regno)
+static void
+i386_linux_fetch_inferior_registers (int regno)
{
int tid;
@@ -514,7 +515,7 @@ fetch_inferior_registers (int regno)
/* The call above might reset `have_ptrace_getregs'. */
if (!have_ptrace_getregs)
{
- fetch_inferior_registers (regno);
+ i386_linux_fetch_inferior_registers (regno);
return;
}
@@ -552,8 +553,8 @@ fetch_inferior_registers (int regno)
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-void
-store_inferior_registers (int regno)
+static void
+i386_linux_store_inferior_registers (int regno)
{
int tid;
@@ -755,8 +756,8 @@ static const unsigned char linux_syscall
If STEP is nonzero, single-step it.
If SIGNAL is nonzero, give it that signal. */
-void
-child_resume (ptid_t ptid, int step, enum target_signal signal)
+static void
+i386_linux_resume (ptid_t ptid, int step, enum target_signal signal)
{
int pid = PIDGET (ptid);
@@ -814,9 +815,34 @@ child_resume (ptid_t ptid, int step, enu
perror_with_name (("ptrace"));
}
-void
-child_post_startup_inferior (ptid_t ptid)
+static void (*super_post_startup_inferior) (ptid_t ptid);
+
+static void
+i386_linux_child_post_startup_inferior (ptid_t ptid)
{
i386_cleanup_dregs ();
- linux_child_post_startup_inferior (ptid);
+ super_post_startup_inferior (ptid);
+}
+
+void
+_initialize_i386_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Override the default ptrace resume method. */
+ t->to_resume = i386_linux_resume;
+
+ /* Override the GNU/Linux inferior startup hook. */
+ super_post_startup_inferior = t->to_post_startup_inferior;
+ t->to_post_startup_inferior = i386_linux_child_post_startup_inferior;
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = i386_linux_fetch_inferior_registers;
+ t->to_store_registers = i386_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
}
Index: i386-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nat.c,v
retrieving revision 1.11
diff -u -p -r1.11 i386-nat.c
--- i386-nat.c 21 Feb 2005 17:14:03 -0000 1.11
+++ i386-nat.c 10 Sep 2005 18:01:06 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for the i386.
- Copyright 2001, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -231,8 +231,6 @@ i386_cleanup_dregs (void)
dr_status_mirror = 0;
}
-#ifndef LINUX_CHILD_POST_STARTUP_INFERIOR
-
/* Reset all debug registers at each new startup to avoid missing
watchpoints after restart. */
@@ -242,8 +240,6 @@ child_post_startup_inferior (ptid_t ptid
i386_cleanup_dregs ();
}
-#endif /* LINUX_CHILD_POST_STARTUP_INFERIOR */
-
/* Print the values of the mirrored debug registers. This is called
when maint_show_dr is non-zero. To set that up, type "maint
show-debug-regs" at GDB's prompt. */
Index: ia64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-linux-nat.c,v
retrieving revision 1.28
diff -u -p -r1.28 ia64-linux-nat.c
--- ia64-linux-nat.c 11 Feb 2005 04:05:51 -0000 1.28
+++ ia64-linux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -28,6 +28,7 @@
#include "gdbcore.h"
#include "regcache.h"
#include "ia64-tdep.h"
+#include "linux-nat.h"
#include <signal.h>
#include <sys/ptrace.h>
@@ -666,12 +667,38 @@ ia64_linux_stopped_by_watchpoint (void)
return ia64_linux_stopped_data_address (&addr);
}
-LONGEST
-ia64_linux_xfer_unwind_table (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- void *readbuf, const void *writebuf,
- ULONGEST offset, LONGEST len)
+static LONGEST (*super_xfer_partial) (struct target_ops *, enum target_object,
+ const char *, gdb_byte *, const gdb_byte *,
+ ULONGEST, LONGEST);
+
+static LONGEST
+ia64_linux_xfer_partial (struct target_ops *ops,
+ enum target_object object,
+ const char *annex,
+ gdb_byte *readbuf, const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len)
+{
+ if (object == TARGET_OBJECT_UNWIND_TABLE && writebuf == NULL && offset == 0)
+ return syscall (__NR_getunwind, readbuf, len);
+
+ return super_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+}
+
+void _initialize_ia64_linux_nat (void);
+
+void
+_initialize_ia64_linux_nat (void)
{
- return syscall (__NR_getunwind, readbuf, len);
+ struct target_ops *t = linux_target ();
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Override the default to_xfer_partial. */
+ super_xfer_partial = t->to_xfer_partial;
+ t->to_xfer_partial = ia64_linux_xfer_partial;
+
+ /* Register the target. */
+ add_target (t);
}
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.134
diff -u -p -r1.134 ia64-tdep.c
--- ia64-tdep.c 10 Jun 2005 01:09:18 -0000 1.134
+++ ia64-tdep.c 10 Sep 2005 18:01:06 -0000
@@ -2460,17 +2460,19 @@ getunwind_table (void *buf, size_t len)
{
LONGEST x;
- /* FIXME: This is a temporary solution to backtracing syscalls in corefiles.
- To do this properly, the AUXV section should be used. This
- fix will work as long as the kernel used to generate the corefile
- is equivalent to the kernel used to debug the corefile. */
- x = ia64_linux_xfer_unwind_table (¤t_target,
- TARGET_OBJECT_UNWIND_TABLE, NULL,
- buf, NULL, 0, len);
+ /* FIXME drow/2005-09-10: This code used to call
+ ia64_linux_xfer_unwind_table directly to fetch the unwind table
+ for the currently running ia64-linux kernel. That data should
+ come from the core file and be accessed via the auxv vector; if
+ we want to preserve fall back to the running kernel's table, then
+ we should find a way to override the corefile layer's
+ xfer_partial method. */
+ x = target_read_partial (¤t_target, TARGET_OBJECT_UNWIND_TABLE, NULL,
+ buf, 0, len);
return (int)x;
}
-
+
/* Get the kernel unwind table. */
static int
get_kernel_table (unw_word_t ip, unw_dyn_info_t *di)
Index: inf-ptrace.c
===================================================================
RCS file: /cvs/src/src/gdb/inf-ptrace.c,v
retrieving revision 1.25
diff -u -p -r1.25 inf-ptrace.c
--- inf-ptrace.c 4 Sep 2005 16:18:19 -0000 1.25
+++ inf-ptrace.c 10 Sep 2005 18:01:06 -0000
@@ -626,8 +626,14 @@ inf_ptrace_fetch_register (int regnum)
PTRACE_TYPE_RET *buf;
int pid, i;
+ if (CANNOT_FETCH_REGISTER (regnum))
+ {
+ regcache_raw_supply (current_regcache, regnum, NULL);
+ return;
+ }
+
/* Cater for systems like GNU/Linux, that implement threads as
- seperate processes. */
+ separate processes. */
pid = ptid_get_lwp (inferior_ptid);
if (pid == 0)
pid = ptid_get_pid (inferior_ptid);
@@ -639,7 +645,7 @@ inf_ptrace_fetch_register (int regnum)
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
buf = alloca (size);
- /* Read the register contents from the inferior a chuck at the time. */
+ /* Read the register contents from the inferior a chunk at a time. */
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
errno = 0;
@@ -676,8 +682,11 @@ inf_ptrace_store_register (int regnum)
PTRACE_TYPE_RET *buf;
int pid, i;
+ if (CANNOT_STORE_REGISTER (regnum))
+ return;
+
/* Cater for systems like GNU/Linux, that implement threads as
- seperate processes. */
+ separate processes. */
pid = ptid_get_lwp (inferior_ptid);
if (pid == 0)
pid = ptid_get_pid (inferior_ptid);
@@ -689,7 +698,7 @@ inf_ptrace_store_register (int regnum)
gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
buf = alloca (size);
- /* Write the register contents into the inferior a chunk at the time. */
+ /* Write the register contents into the inferior a chunk at a time. */
regcache_raw_collect (current_regcache, regnum, buf);
for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
{
Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.32
diff -u -p -r1.32 linux-nat.c
--- linux-nat.c 4 Sep 2005 16:18:20 -0000 1.32
+++ linux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -34,6 +34,8 @@
#include "gdbthread.h"
#include "gdbcmd.h"
#include "regcache.h"
+#include "inf-ptrace.h"
+#include "auxv.h"
#include <sys/param.h> /* for MAXPATHLEN */
#include <sys/procfs.h> /* for elf_gregset etc. */
#include "elf-bfd.h" /* for elfcore_write_* */
@@ -81,6 +83,16 @@
#define __WALL 0x40000000 /* Wait for any child. */
#endif
+/* The single-threaded native GNU/Linux target_ops. We save a pointer for
+ the use of the multi-threaded target. */
+static struct target_ops *linux_ops;
+
+/* The saved to_xfer_partial method, inherited from inf-ptrace.c. Called
+ by our to_xfer_partial. */
+static LONGEST (*super_xfer_partial) (struct target_ops *, enum target_object,
+ const char *, gdb_byte *, const gdb_byte *,
+ ULONGEST, LONGEST);
+
static int debug_linux_nat;
static void
show_debug_linux_nat (struct ui_file *file, int from_tty,
@@ -319,20 +331,12 @@ child_post_attach (int pid)
linux_enable_event_reporting (pid_to_ptid (pid));
}
-void
+static void
linux_child_post_startup_inferior (ptid_t ptid)
{
linux_enable_event_reporting (ptid);
}
-#ifndef LINUX_CHILD_POST_STARTUP_INFERIOR
-void
-child_post_startup_inferior (ptid_t ptid)
-{
- linux_child_post_startup_inferior (ptid);
-}
-#endif
-
int
child_follow_fork (struct target_ops *ops, int follow_child)
{
@@ -913,7 +917,7 @@ linux_nat_attach (char *args, int from_t
/* FIXME: We should probably accept a list of process id's, and
attach all of them. */
- deprecated_child_ops.to_attach (args, from_tty);
+ linux_ops->to_attach (args, from_tty);
/* Add the initial process as the first LWP to the list. */
lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid)));
@@ -1023,7 +1027,7 @@ linux_nat_detach (char *args, int from_t
sigemptyset (&blocked_mask);
inferior_ptid = pid_to_ptid (GET_PID (inferior_ptid));
- deprecated_child_ops.to_detach (args, from_tty);
+ linux_ops->to_detach (args, from_tty);
}
/* Resume LP. */
@@ -1035,7 +1039,8 @@ resume_callback (struct lwp_info *lp, vo
{
struct thread_info *tp;
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), 0, TARGET_SIGNAL_0);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ 0, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"RC: PTRACE_CONT %s, 0, 0 (resume sibling)\n",
@@ -1109,7 +1114,7 @@ linux_nat_resume (ptid_t ptid, int step,
if (resume_all)
iterate_over_lwps (resume_callback, NULL);
- child_resume (ptid, step, signo);
+ linux_ops->to_resume (ptid, step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLR: %s %s, %s (resume event thread)\n",
@@ -1683,8 +1688,6 @@ resumed_callback (struct lwp_info *lp, v
return lp->resumed;
}
-#ifdef CHILD_WAIT
-
/* We need to override child_wait to support attaching to cloned
processes, since a normal wait (as done by the default version)
ignores those processes. */
@@ -1789,8 +1792,6 @@ child_wait (ptid_t ptid, struct target_w
return pid_to_ptid (pid);
}
-#endif
-
/* Stop an active thread, verify it still exists, then resume it. */
static int
@@ -1899,8 +1900,8 @@ retry:
/* Resume the thread. It should halt immediately returning the
pending SIGSTOP. */
registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (expect SIGSTOP)\n",
@@ -2101,8 +2102,8 @@ retry:
lp->signalled = 0;
registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step,
- TARGET_SIGNAL_0);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, TARGET_SIGNAL_0);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, 0, 0 (discard SIGSTOP)\n",
@@ -2161,7 +2162,8 @@ retry:
newly attached threads may cause an unwanted delay in
getting them running. */
registers_changed ();
- child_resume (pid_to_ptid (GET_LWP (lp->ptid)), lp->step, signo);
+ linux_ops->to_resume (pid_to_ptid (GET_LWP (lp->ptid)),
+ lp->step, signo);
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLW: %s %s, %s (preempt 'handle')\n",
@@ -2310,7 +2312,7 @@ static void
linux_nat_create_inferior (char *exec_file, char *allargs, char **env,
int from_tty)
{
- deprecated_child_ops.to_create_inferior (exec_file, allargs, env, from_tty);
+ linux_ops->to_create_inferior (exec_file, allargs, env, from_tty);
}
static void
@@ -2325,23 +2327,23 @@ linux_nat_mourn_inferior (void)
sigprocmask (SIG_SETMASK, &normal_mask, NULL);
sigemptyset (&blocked_mask);
- deprecated_child_ops.to_mourn_inferior ();
+ linux_ops->to_mourn_inferior ();
}
-static int
-linux_nat_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
- int write, struct mem_attrib *attrib,
- struct target_ops *target)
+static LONGEST
+linux_nat_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len)
{
struct cleanup *old_chain = save_inferior_ptid ();
- int xfer;
+ LONGEST xfer;
if (is_lwp (inferior_ptid))
inferior_ptid = pid_to_ptid (GET_LWP (inferior_ptid));
- xfer = linux_proc_xfer_memory (memaddr, myaddr, len, write, attrib, target);
- if (xfer == 0)
- xfer = child_xfer_memory (memaddr, myaddr, len, write, attrib, target);
+ xfer = linux_ops->to_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
do_cleanups (old_chain);
return xfer;
@@ -2380,6 +2382,26 @@ linux_nat_pid_to_str (ptid_t ptid)
}
static void
+linux_nat_fetch_registers (int regnum)
+{
+ /* to_fetch_registers will honor the LWP ID, so we can use it directly. */
+ linux_ops->to_fetch_registers (regnum);
+}
+
+static void
+linux_nat_store_registers (int regnum)
+{
+ /* to_store_registers will honor the LWP ID, so we can use it directly. */
+ linux_ops->to_store_registers (regnum);
+}
+
+static void
+linux_nat_child_post_startup_inferior (ptid_t ptid)
+{
+ linux_ops->to_post_startup_inferior (ptid);
+}
+
+static void
init_linux_nat_ops (void)
{
#if 0
@@ -2392,17 +2414,16 @@ init_linux_nat_ops (void)
linux_nat_ops.to_detach = linux_nat_detach;
linux_nat_ops.to_resume = linux_nat_resume;
linux_nat_ops.to_wait = linux_nat_wait;
- /* fetch_inferior_registers and store_inferior_registers will
- honor the LWP id, so we can use them directly. */
- linux_nat_ops.to_fetch_registers = fetch_inferior_registers;
- linux_nat_ops.to_store_registers = store_inferior_registers;
- linux_nat_ops.deprecated_xfer_memory = linux_nat_xfer_memory;
+ linux_nat_ops.to_fetch_registers = linux_nat_fetch_registers;
+ linux_nat_ops.to_store_registers = linux_nat_store_registers;
+ linux_nat_ops.to_xfer_partial = linux_nat_xfer_partial;
linux_nat_ops.to_kill = linux_nat_kill;
linux_nat_ops.to_create_inferior = linux_nat_create_inferior;
linux_nat_ops.to_mourn_inferior = linux_nat_mourn_inferior;
linux_nat_ops.to_thread_alive = linux_nat_thread_alive;
linux_nat_ops.to_pid_to_str = linux_nat_pid_to_str;
- linux_nat_ops.to_post_startup_inferior = child_post_startup_inferior;
+ linux_nat_ops.to_post_startup_inferior
+ = linux_nat_child_post_startup_inferior;
linux_nat_ops.to_post_attach = child_post_attach;
linux_nat_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
linux_nat_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
@@ -2948,14 +2969,22 @@ linux_nat_info_proc_cmd (char *args, int
}
}
-int
-linux_proc_xfer_memory (CORE_ADDR addr, gdb_byte *myaddr, int len, int write,
- struct mem_attrib *attrib, struct target_ops *target)
+/* Implement the to_xfer_partial interface for memory reads using the /proc
+ filesystem. Because we can use a single read() call for /proc, this
+ can be much more efficient than banging away at PTRACE_PEEKTEXT,
+ but it doesn't support writes. */
+
+static LONGEST
+linux_proc_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf,
+ ULONGEST offset, LONGEST len)
{
- int fd, ret;
+ LONGEST ret;
+ int fd;
char filename[64];
- if (write)
+ if (object != TARGET_OBJECT_MEMORY || !readbuf)
return 0;
/* Don't bother for one word. */
@@ -2974,9 +3003,9 @@ linux_proc_xfer_memory (CORE_ADDR addr,
32-bit platforms (for instance, SPARC debugging a SPARC64
application). */
#ifdef HAVE_PREAD64
- if (pread64 (fd, myaddr, len, addr) != len)
+ if (pread64 (fd, readbuf, len, offset) != len)
#else
- if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
+ if (lseek (fd, offset, SEEK_SET) == -1 || read (fd, readbuf, len) != len)
#endif
ret = 0;
else
@@ -3067,15 +3096,80 @@ linux_proc_pending_signals (int pid, sig
fclose (procfile);
}
+static LONGEST
+linux_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
+{
+ LONGEST xfer;
+
+ if (object == TARGET_OBJECT_AUXV)
+ return procfs_xfer_auxv (ops, object, annex, readbuf, writebuf,
+ offset, len);
+
+ xfer = linux_proc_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+ if (xfer != 0)
+ return xfer;
+
+ return super_xfer_partial (ops, object, annex, readbuf, writebuf,
+ offset, len);
+}
+
+#ifndef FETCH_INFERIOR_REGISTERS
+
+/* Return the address in the core dump or inferior of register
+ REGNO. */
+
+static CORE_ADDR
+linux_register_u_offset (int regno)
+{
+ /* FIXME drow/2005-09-04: The hardcoded use of register_addr should go
+ away. This requires disentangling the various definitions of it
+ (particularly alpha-nat.c's). */
+ return register_addr (regno, 0);
+}
+
+#endif
+
+/* Create a prototype generic Linux target. The client can override
+ it with local methods. */
+
+struct target_ops *
+linux_target (void)
+{
+ struct target_ops *t;
+
+#ifdef FETCH_INFERIOR_REGISTERS
+ t = inf_ptrace_target ();
+#else
+ t = inf_ptrace_trad_target (linux_register_u_offset);
+#endif
+ t->to_wait = child_wait;
+ t->to_kill = kill_inferior;
+ t->to_insert_fork_catchpoint = child_insert_fork_catchpoint;
+ t->to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
+ t->to_insert_exec_catchpoint = child_insert_exec_catchpoint;
+ t->to_pid_to_exec_file = child_pid_to_exec_file;
+ t->to_post_startup_inferior = linux_child_post_startup_inferior;
+ t->to_post_attach = child_post_attach;
+ t->to_follow_fork = child_follow_fork;
+ t->to_find_memory_regions = linux_nat_find_memory_regions;
+ t->to_make_corefile_notes = linux_nat_make_corefile_notes;
+
+ super_xfer_partial = t->to_xfer_partial;
+ t->to_xfer_partial = linux_xfer_partial;
+
+ linux_ops = t;
+ return t;
+}
+
void
_initialize_linux_nat (void)
{
struct sigaction action;
extern void thread_db_init (struct target_ops *);
- deprecated_child_ops.to_find_memory_regions = linux_nat_find_memory_regions;
- deprecated_child_ops.to_make_corefile_notes = linux_nat_make_corefile_notes;
-
add_info ("proc", linux_nat_info_proc_cmd, _("\
Show /proc process information about any running process.\n\
Specify any process id, or use the program being debugged by default.\n\
Index: linux-nat.h
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.h,v
retrieving revision 1.7
diff -u -p -r1.7 linux-nat.h
--- linux-nat.h 9 Aug 2005 16:35:45 -0000 1.7
+++ linux-nat.h 10 Sep 2005 18:01:06 -0000
@@ -1,5 +1,7 @@
/* Native debugging support for GNU/Linux (LWP layer).
- Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -63,14 +65,6 @@ struct lwp_info
struct lwp_info *next;
};
-/* Read/write to target memory via the Linux kernel's "proc file
- system". */
-struct mem_attrib;
-struct target_ops;
-
-extern int linux_proc_xfer_memory (CORE_ADDR addr, gdb_byte *myaddr, int len,
- int write, struct mem_attrib *attrib,
- struct target_ops *target);
/* Find process PID's pending signal set from /proc/pid/status. */
void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored);
@@ -80,9 +74,12 @@ extern void linux_record_stopped_pid (in
extern void linux_enable_event_reporting (ptid_t ptid);
extern ptid_t linux_handle_extended_wait (int pid, int status,
struct target_waitstatus *ourstatus);
-extern void linux_child_post_startup_inferior (ptid_t ptid);
/* Iterator function for lin-lwp's lwp list. */
struct lwp_info *iterate_over_lwps (int (*callback) (struct lwp_info *,
void *),
void *data);
+
+/* Create a prototype generic Linux target. The client can override
+ it with local methods. */
+struct target_ops * linux_target (void);
Index: linux-thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-thread-db.c,v
retrieving revision 1.9
diff -u -p -r1.9 linux-thread-db.c
--- linux-thread-db.c 28 May 2005 16:44:29 -0000 1.9
+++ linux-thread-db.c 10 Sep 2005 18:01:06 -0000
@@ -1,6 +1,7 @@
/* libthread_db assisted debugging support, generic parts.
- Copyright 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -961,12 +962,13 @@ thread_db_wait (ptid_t ptid, struct targ
return ptid;
}
-static int
-thread_db_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
- struct mem_attrib *attrib, struct target_ops *target)
+static LONGEST
+thread_db_xfer_partial (struct target_ops *ops, enum target_object object,
+ const char *annex, gdb_byte *readbuf,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
{
struct cleanup *old_chain = save_inferior_ptid ();
- int xfer;
+ LONGEST xfer;
if (is_thread (inferior_ptid))
{
@@ -978,9 +980,8 @@ thread_db_xfer_memory (CORE_ADDR memaddr
inferior_ptid = lwp_from_thread (inferior_ptid);
}
- xfer =
- target_beneath->deprecated_xfer_memory (memaddr, myaddr, len, write,
- attrib, target);
+ xfer = target_beneath->to_xfer_partial (ops, object, annex,
+ readbuf, writebuf, offset, len);
do_cleanups (old_chain);
return xfer;
@@ -1298,7 +1299,7 @@ init_thread_db_ops (void)
thread_db_ops.to_wait = thread_db_wait;
thread_db_ops.to_fetch_registers = thread_db_fetch_registers;
thread_db_ops.to_store_registers = thread_db_store_registers;
- thread_db_ops.deprecated_xfer_memory = thread_db_xfer_memory;
+ thread_db_ops.to_xfer_partial = thread_db_xfer_partial;
thread_db_ops.to_kill = thread_db_kill;
thread_db_ops.to_create_inferior = thread_db_create_inferior;
thread_db_ops.to_post_startup_inferior = thread_db_post_startup_inferior;
Index: m32r-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/m32r-linux-nat.c,v
retrieving revision 1.2
diff -u -p -r1.2 m32r-linux-nat.c
--- m32r-linux-nat.c 11 Feb 2005 18:13:51 -0000 1.2
+++ m32r-linux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux m32r.
- Copyright 2004 Free Software Foundation, Inc.
+ Copyright 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -24,6 +24,7 @@
#include "gdbcore.h"
#include "regcache.h"
#include "linux-nat.h"
+#include "target.h"
#include "gdb_assert.h"
#include "gdb_string.h"
@@ -187,8 +188,8 @@ fill_fpregset (gdb_fpregset_t *fpregs, i
this for all registers (including the floating point and SSE
registers). */
-void
-fetch_inferior_registers (int regno)
+static void
+m32r_linux_fetch_inferior_registers (int regno)
{
int tid;
@@ -213,8 +214,8 @@ fetch_inferior_registers (int regno)
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-void
-store_inferior_registers (int regno)
+static void
+m32r_linux_store_inferior_registers (int regno)
{
int tid;
@@ -233,3 +234,21 @@ store_inferior_registers (int regno)
internal_error (__FILE__, __LINE__,
_("Got request to store bad register number %d."), regno);
}
+
+void _initialize_m32r_linux_nat (void);
+
+void
+_initialize_m32r_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = m32r_linux_fetch_inferior_registers;
+ t->to_store_registers = m32r_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: m68klinux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/m68klinux-nat.c,v
retrieving revision 1.28
diff -u -p -r1.28 m68klinux-nat.c
--- m68klinux-nat.c 11 Feb 2005 18:13:51 -0000 1.28
+++ m68klinux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -1,7 +1,7 @@
/* Motorola m68k native support for GNU/Linux.
- Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation,
- Inc.
+ Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,6 +27,8 @@
#include "gdbcore.h"
#include "gdb_string.h"
#include "regcache.h"
+#include "target.h"
+#include "linux-nat.h"
#include "m68k-tdep.h"
@@ -170,7 +172,7 @@ fetch_register (int regno)
If REGNO is negative, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */
-void
+static void
old_fetch_inferior_registers (int regno)
{
if (regno >= 0)
@@ -237,7 +239,7 @@ store_register (int regno)
If REGNO is negative, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */
-void
+static void
old_store_inferior_registers (int regno)
{
if (regno >= 0)
@@ -442,8 +444,8 @@ static void store_fpregs (int tid, int r
this for all registers (including the floating point and SSE
registers). */
-void
-fetch_inferior_registers (int regno)
+static void
+m68k_linux_fetch_inferior_registers (int regno)
{
int tid;
@@ -498,8 +500,8 @@ fetch_inferior_registers (int regno)
/* Store register REGNO back into the child process. If REGNO is -1,
do this for all registers (including the floating point and SSE
registers). */
-void
-store_inferior_registers (int regno)
+static void
+m68k_linux_store_inferior_registers (int regno)
{
int tid;
@@ -616,8 +618,22 @@ static struct core_fns linux_elf_core_fn
NULL /* next */
};
+void _initialize_m68k_linux_nat (void);
+
void
_initialize_m68k_linux_nat (void)
{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = m68k_linux_fetch_inferior_registers;
+ t->to_store_registers = m68k_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+
deprecated_add_core_fns (&linux_elf_core_fns);
}
Index: mips-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-linux-nat.c,v
retrieving revision 1.9
diff -u -p -r1.9 mips-linux-nat.c
--- mips-linux-nat.c 30 Oct 2004 22:54:40 -0000 1.9
+++ mips-linux-nat.c 10 Sep 2005 18:01:06 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux on MIPS processors.
- Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -21,6 +21,8 @@
#include "defs.h"
#include "mips-tdep.h"
+#include "target.h"
+#include "linux-nat.h"
/* Pseudo registers can not be read. ptrace does not provide a way to
read (or set) MIPS_PS_REGNUM, and there's no point in reading or
@@ -62,3 +64,11 @@ mips_linux_cannot_store_register (int re
else
return 1;
}
+
+void _initialize_mips_linux_nat (void);
+
+void
+_initialize_mips_linux_nat (void)
+{
+ add_target (linux_target ());
+}
Index: ppc-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
retrieving revision 1.54
diff -u -p -r1.54 ppc-linux-nat.c
--- ppc-linux-nat.c 11 Feb 2005 18:13:51 -0000 1.54
+++ ppc-linux-nat.c 10 Sep 2005 18:01:07 -0000
@@ -1,7 +1,7 @@
/* PPC GNU/Linux native support.
Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
+ 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -27,6 +27,8 @@
#include "gdbcore.h"
#include "regcache.h"
#include "gdb_assert.h"
+#include "target.h"
+#include "linux-nat.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -494,8 +496,8 @@ fetch_ppc_registers (int tid)
/* Fetch registers from the child process. Fetch all registers if
regno == -1, otherwise fetch all general registers or all floating
point registers depending upon the value of regno. */
-void
-fetch_inferior_registers (int regno)
+static void
+ppc_linux_fetch_inferior_registers (int regno)
{
/* Overload thread id onto process id */
int tid = TIDGET (inferior_ptid);
@@ -775,8 +777,8 @@ store_ppc_registers (int tid)
store_spe_register (tid, -1);
}
-void
-store_inferior_registers (int regno)
+static void
+ppc_linux_store_inferior_registers (int regno)
{
/* Overload thread id onto process id */
int tid = TIDGET (inferior_ptid);
@@ -883,3 +885,21 @@ fill_fpregset (gdb_fpregset_t *fpregsetp
right_fill_reg (tdep->ppc_fpscr_regnum, (fpp + 8 * 32));
}
}
+
+void _initialize_ppc_linux_nat (void);
+
+void
+_initialize_ppc_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = ppc_linux_fetch_inferior_registers;
+ t->to_store_registers = ppc_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: s390-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-nat.c,v
retrieving revision 1.13
diff -u -p -r1.13 s390-nat.c
--- s390-nat.c 11 Feb 2005 18:13:52 -0000 1.13
+++ s390-nat.c 10 Sep 2005 18:01:07 -0000
@@ -1,5 +1,5 @@
/* S390 native-dependent code for GDB, the GNU debugger.
- Copyright 2001, 2003 Free Software Foundation, Inc
+ Copyright 2001, 2003, 2004, 2005 Free Software Foundation, Inc
Contributed by D.J. Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
for IBM Deutschland Entwicklung GmbH, IBM Corporation.
@@ -25,6 +25,8 @@
#include "tm.h"
#include "regcache.h"
#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"
#include "s390-tdep.h"
@@ -200,8 +202,8 @@ store_fpregs (int tid, int regnum)
/* Fetch register REGNUM from the child process. If REGNUM is -1, do
this for all registers. */
-void
-fetch_inferior_registers (int regnum)
+static void
+s390_linux_fetch_inferior_registers (int regnum)
{
int tid = s390_inferior_tid ();
@@ -216,8 +218,8 @@ fetch_inferior_registers (int regnum)
/* Store register REGNUM back into the child process. If REGNUM is
-1, do this for all registers. */
-void
-store_inferior_registers (int regnum)
+static void
+s390_linux_store_inferior_registers (int regnum)
{
int tid = s390_inferior_tid ();
@@ -357,3 +359,20 @@ kernel_u_size (void)
return sizeof (struct user);
}
+void _initialize_s390_nat (void);
+
+void
+_initialize_s390_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = s390_linux_fetch_inferior_registers;
+ t->to_store_registers = s390_linux_store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: sparc-linux-nat.c
===================================================================
RCS file: sparc-linux-nat.c
diff -N sparc-linux-nat.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sparc-linux-nat.c 10 Sep 2005 18:01:07 -0000
@@ -0,0 +1,43 @@
+/* Native-dependent code for GNU/Linux SPARC.
+ Copyright 2005
+ Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"
+
+void _initialialize_sparc_linux_nat (void);
+
+void
+_initialize_sparc_linux_nat (void)
+{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = fetch_inferior_registers;
+ t->to_store_registers = store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+}
Index: sparc64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-linux-nat.c,v
retrieving revision 1.2
diff -u -p -r1.2 sparc64-linux-nat.c
--- sparc64-linux-nat.c 3 Jan 2004 10:08:44 -0000 1.2
+++ sparc64-linux-nat.c 10 Sep 2005 18:01:07 -0000
@@ -1,6 +1,6 @@
/* Native-dependent code for GNU/Linux UltraSPARC.
- Copyright 2003 Free Software Foundation, Inc.
+ Copyright 2003, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -23,6 +23,9 @@
#include "sparc64-tdep.h"
#include "sparc-nat.h"
+#include "inferior.h"
+#include "target.h"
+#include "linux-nat.h"
static const struct sparc_gregset sparc64_linux_ptrace_gregset =
{
@@ -44,5 +47,17 @@ void _initialize_sparc64_linux_nat (void
void
_initialize_sparc64_linux_nat (void)
{
+ struct target_ops *t;
+
+ /* Fill in the generic GNU/Linux methods. */
+ t = linux_target ();
+
+ /* Add our register access methods. */
+ t->to_fetch_registers = fetch_inferior_registers;
+ t->to_store_registers = store_inferior_registers;
+
+ /* Register the target. */
+ add_target (t);
+
sparc_gregset = &sparc64_linux_ptrace_gregset;
}
Index: config/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/nm-linux.h,v
retrieving revision 1.24
diff -u -p -r1.24 nm-linux.h
--- config/nm-linux.h 20 Sep 2004 16:39:34 -0000 1.24
+++ config/nm-linux.h 10 Sep 2005 18:01:07 -0000
@@ -1,6 +1,7 @@
/* Native support for GNU/Linux.
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -42,11 +43,6 @@ struct target_ops;
#endif
\f
-/* Override child_wait in `inftarg.c'. */
-struct target_waitstatus;
-extern ptid_t child_wait (ptid_t ptid, struct target_waitstatus *ourstatus);
-#define CHILD_WAIT
-
extern void lin_lwp_attach_lwp (ptid_t ptid, int verbose);
#define ATTACH_LWP(ptid, verbose) lin_lwp_attach_lwp ((ptid), (verbose))
@@ -58,17 +54,3 @@ extern void lin_thread_get_thread_signal
#define GDB_GREGSET_T elf_gregset_t
#define GDB_FPREGSET_T elf_fpregset_t
-
-/* Override child_pid_to_exec_file in 'inftarg.c'. */
-#define CHILD_PID_TO_EXEC_FILE
-
-#define CHILD_INSERT_FORK_CATCHPOINT
-#define CHILD_INSERT_VFORK_CATCHPOINT
-#define CHILD_INSERT_EXEC_CATCHPOINT
-#define CHILD_POST_STARTUP_INFERIOR
-#define CHILD_POST_ATTACH
-#define CHILD_FOLLOW_FORK
-#define DEPRECATED_KILL_INFERIOR
-
-#define NATIVE_XFER_AUXV procfs_xfer_auxv
-#include "auxv.h" /* Declares it. */
Index: config/alpha/alpha-linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/alpha/alpha-linux.mh,v
retrieving revision 1.17
diff -u -p -r1.17 alpha-linux.mh
--- config/alpha/alpha-linux.mh 14 Nov 2004 18:47:50 -0000 1.17
+++ config/alpha/alpha-linux.mh 10 Sep 2005 18:01:07 -0000
@@ -1,6 +1,6 @@
# Host: Little-endian Alpha running Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o \
+NATDEPFILES= inf-ptrace.o corelow.o alpha-nat.o alpha-linux-nat.o \
fork-child.o proc-service.o linux-thread-db.o gcore.o \
linux-nat.o
Index: config/arm/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/linux.mh,v
retrieving revision 1.15
diff -u -p -r1.15 linux.mh
--- config/arm/linux.mh 14 Nov 2004 18:47:51 -0000 1.15
+++ config/arm/linux.mh 10 Sep 2005 18:01:07 -0000
@@ -1,7 +1,7 @@
# Host: ARM based machine running GNU/Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
core-regset.o arm-linux-nat.o gcore.o \
proc-service.o linux-thread-db.o linux-nat.o
Index: config/djgpp/fnchange.lst
===================================================================
RCS file: /cvs/src/src/gdb/config/djgpp/fnchange.lst,v
retrieving revision 1.92
diff -u -p -r1.92 fnchange.lst
--- config/djgpp/fnchange.lst 29 May 2005 07:36:09 -0000 1.92
+++ config/djgpp/fnchange.lst 10 Sep 2005 18:01:07 -0000
@@ -83,6 +83,8 @@
@V@/gdb/alphabsd-nat.c @V@/gdb/alphb-nat.c
@V@/gdb/alphabsd-tdep.c @V@/gdb/alphb-tdep.c
@V@/gdb/alphanbsd-tdep.c @V@/gdb/alphnb-tdep.c
+@V@/gdb/alpha-linux-nat.c @V@/gdb/alphl-nat.c
+@V@/gdb/alpha-linux-tdep.c @V@/gdb/alphl-tdep.c
@V@/gdb/arm-linux-nat.c @V@/gdb/armlin-nat.c
@V@/gdb/arm-linux-tdep.c @V@/gdb/armlin-tdep.c
@V@/gdb/armnbsd-nat.c @V@/gdb/armnbd-nat.c
@@ -201,6 +203,8 @@
@V@/gdb/sparc64-sol2-tdep.c @V@/gdb/sp64s2-tdep.c
@V@/gdb/sparcnbsd-nat.c @V@/gdb/spnb-nat.c
@V@/gdb/sparcnbsd-tdep.c @V@/gdb/spnb-tdep.c
+@V@/gdb/sparc-linux-nat.c @V@/gdb/splx-nat.c
+@V@/gdb/sparc-linux-tdep.c @V@/gdb/splx-tdep.c
@V@/gdb/sparc-sol2-nat.c @V@/gdb/spsol2-nat.c
@V@/gdb/sparc-sol2-tdep.c @V@/gdb/spsol2-tdep.c
@V@/gdb/testsuite/.gdbinit @V@/gdb/testsuite/gdb.ini
Index: config/i386/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux.mh,v
retrieving revision 1.17
diff -u -p -r1.17 linux.mh
--- config/i386/linux.mh 14 Nov 2004 18:47:51 -0000 1.17
+++ config/i386/linux.mh 10 Sep 2005 18:01:07 -0000
@@ -1,7 +1,7 @@
# Host: Intel 386 running GNU/Linux.
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
core-aout.o i386-nat.o i386-linux-nat.o \
proc-service.o linux-thread-db.o gcore.o \
linux-nat.o
Index: config/i386/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/linux64.mh,v
retrieving revision 1.5
diff -u -p -r1.5 linux64.mh
--- config/i386/linux64.mh 14 Nov 2004 18:47:51 -0000 1.5
+++ config/i386/linux64.mh 10 Sep 2005 18:01:07 -0000
@@ -1,5 +1,5 @@
# Host: GNU/Linux x86-64
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
proc-service.o linux-thread-db.o gcore.o
NAT_FILE= nm-linux64.h
Index: config/i386/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux.h,v
retrieving revision 1.21
diff -u -p -r1.21 nm-linux.h
--- config/i386/nm-linux.h 20 Sep 2004 16:39:35 -0000 1.21
+++ config/i386/nm-linux.h 10 Sep 2005 18:01:07 -0000
@@ -1,7 +1,8 @@
/* Native support for GNU/Linux x86.
Copyright 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ Free Software Foundation, Inc.
This file is part of GDB.
@@ -79,16 +80,4 @@ extern int cannot_store_register (int re
#define FILL_FPXREGSET
#endif
-/* Override child_resume in `infptrace.c'. */
-#define DEPRECATED_CHILD_RESUME
-
-/* `linux-nat.c' and `i386-nat.c' have their own versions of
- child_post_startup_inferior. Define this to use the copy in
- `i386-linux-nat.c' instead, which calls both.
-
- NOTE drow/2003-08-17: This is ugly beyond words, but properly
- fixing it will require some serious surgery. Ideally the target
- stack could be used for this. */
-#define LINUX_CHILD_POST_STARTUP_INFERIOR
-
#endif /* nm-linux.h */
Index: config/i386/nm-linux64.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-linux64.h,v
retrieving revision 1.2
diff -u -p -r1.2 nm-linux64.h
--- config/i386/nm-linux64.h 15 Aug 2004 16:10:23 -0000 1.2
+++ config/i386/nm-linux64.h 10 Sep 2005 18:01:07 -0000
@@ -1,6 +1,6 @@
/* Native support for GNU/Linux x86-64.
- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Jiri Smid, SuSE Labs.
@@ -55,9 +55,4 @@ extern unsigned long amd64_linux_dr_get_
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS
-/* `linux-nat.c' and `i386-nat.c' have their own versions of
- child_post_startup_inferior. Define this to use the copy in
- `x86-86-linux-nat.c' instead, which calls both. */
-#define LINUX_CHILD_POST_STARTUP_INFERIOR
-
#endif /* nm-linux64.h */
Index: config/ia64/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/linux.mh,v
retrieving revision 1.18
diff -u -p -r1.18 linux.mh
--- config/ia64/linux.mh 14 Nov 2004 18:47:51 -0000 1.18
+++ config/ia64/linux.mh 10 Sep 2005 18:01:07 -0000
@@ -1,7 +1,7 @@
# Host: Intel IA-64 running GNU/Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
core-aout.o core-regset.o ia64-linux-nat.o \
proc-service.o linux-thread-db.o linux-nat.o
Index: config/ia64/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/ia64/nm-linux.h,v
retrieving revision 1.16
diff -u -p -r1.16 nm-linux.h
--- config/ia64/nm-linux.h 8 Oct 2004 17:30:48 -0000 1.16
+++ config/ia64/nm-linux.h 10 Sep 2005 18:01:07 -0000
@@ -1,6 +1,6 @@
/* Native support for GNU/Linux, for GDB, the GNU debugger.
- Copyright 1999, 2000, 2001, 2004
+ Copyright 1999, 2000, 2001, 2004, 2005
Free Software Foundation, Inc.
This file is part of GDB.
@@ -75,15 +75,4 @@ extern int ia64_linux_insert_watchpoint
extern int ia64_linux_remove_watchpoint (ptid_t ptid, CORE_ADDR addr,
int len);
-#include "target.h"
-
-#define NATIVE_XFER_UNWIND_TABLE ia64_linux_xfer_unwind_table
-extern LONGEST ia64_linux_xfer_unwind_table (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- void *readbuf,
- const void *writebuf,
- ULONGEST offset,
- LONGEST len);
-
#endif /* #ifndef NM_LINUX_H */
Index: config/m32r/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m32r/linux.mh,v
retrieving revision 1.2
diff -u -p -r1.2 linux.mh
--- config/m32r/linux.mh 14 Nov 2004 18:47:51 -0000 1.2
+++ config/m32r/linux.mh 10 Sep 2005 18:01:07 -0000
@@ -1,7 +1,7 @@
# Host: M32R based machine running GNU/Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o \
m32r-linux-nat.o gcore.o proc-service.o linux-thread-db.o \
linux-nat.o
Index: config/m68k/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/linux.mh,v
retrieving revision 1.16
diff -u -p -r1.16 linux.mh
--- config/m68k/linux.mh 14 Nov 2004 18:47:51 -0000 1.16
+++ config/m68k/linux.mh 10 Sep 2005 18:01:07 -0000
@@ -1,7 +1,7 @@
# Host: Motorola m68k running GNU/Linux.
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
corelow.o core-aout.o m68klinux-nat.o gcore.o \
proc-service.o linux-thread-db.o linux-nat.o
Index: config/mips/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/linux.mh,v
retrieving revision 1.9
diff -u -p -r1.9 linux.mh
--- config/mips/linux.mh 14 Nov 2004 18:47:51 -0000 1.9
+++ config/mips/linux.mh 10 Sep 2005 18:01:07 -0000
@@ -1,6 +1,6 @@
# Host: Linux/MIPS
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o mips-linux-nat.o \
+NATDEPFILES= inf-ptrace.o fork-child.o mips-linux-nat.o \
linux-thread-db.o proc-service.o gcore.o \
linux-nat.o
Index: config/pa/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/pa/linux.mh,v
retrieving revision 1.5
diff -u -p -r1.5 linux.mh
--- config/pa/linux.mh 14 Nov 2004 18:47:51 -0000 1.5
+++ config/pa/linux.mh 10 Sep 2005 18:01:07 -0000
@@ -1,7 +1,7 @@
# Host: Hewlett-Packard PA-RISC machine, running Linux
XDEPFILES=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o gcore.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
core-regset.o hppa-linux-nat.o \
proc-service.o linux-thread-db.o linux-nat.o
Index: config/powerpc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/linux.mh,v
retrieving revision 1.18
diff -u -p -r1.18 linux.mh
--- config/powerpc/linux.mh 14 Nov 2004 18:47:51 -0000 1.18
+++ config/powerpc/linux.mh 10 Sep 2005 18:01:07 -0000
@@ -3,7 +3,7 @@
XM_CLIBS=
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
ppc-linux-nat.o proc-service.o linux-thread-db.o \
gcore.o linux-nat.o
Index: config/powerpc/ppc64-linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/ppc64-linux.mh,v
retrieving revision 1.7
diff -u -p -r1.7 ppc64-linux.mh
--- config/powerpc/ppc64-linux.mh 14 Nov 2004 18:47:51 -0000 1.7
+++ config/powerpc/ppc64-linux.mh 10 Sep 2005 18:01:07 -0000
@@ -3,7 +3,7 @@
XM_CLIBS=
NAT_FILE= nm-ppc64-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o \
+NATDEPFILES= inf-ptrace.o fork-child.o \
ppc-linux-nat.o proc-service.o linux-thread-db.o \
gcore.o linux-nat.o
Index: config/s390/s390.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/s390/s390.mh,v
retrieving revision 1.12
diff -u -p -r1.12 s390.mh
--- config/s390/s390.mh 14 Nov 2004 18:47:52 -0000 1.12
+++ config/s390/s390.mh 10 Sep 2005 18:01:07 -0000
@@ -1,5 +1,5 @@
# Host: S390, running Linux
NAT_FILE= nm-linux.h
-NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o s390-nat.o \
+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o s390-nat.o \
gcore.o linux-thread-db.o proc-service.o linux-nat.o
LOADLIBES = -ldl -rdynamic
Index: config/sparc/linux.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux.mh,v
retrieving revision 1.15
diff -u -p -r1.15 linux.mh
--- config/sparc/linux.mh 14 Nov 2004 18:47:52 -0000 1.15
+++ config/sparc/linux.mh 10 Sep 2005 18:01:07 -0000
@@ -1,8 +1,7 @@
# Host: GNU/Linux SPARC
NAT_FILE= nm-linux.h
-NATDEPFILES= sparc-nat.o sparc-sol2-nat.o \
+NATDEPFILES= sparc-nat.o sparc-sol2-nat.o sparc-linux-nat.o \
corelow.o core-regset.o fork-child.o inf-ptrace.o \
- infptrace.o inftarg.o \
proc-service.o linux-thread-db.o \
gcore.o linux-nat.o
Index: config/sparc/linux64.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/linux64.mh,v
retrieving revision 1.6
diff -u -p -r1.6 linux64.mh
--- config/sparc/linux64.mh 14 Nov 2004 18:47:52 -0000 1.6
+++ config/sparc/linux64.mh 10 Sep 2005 18:01:07 -0000
@@ -2,7 +2,7 @@
NAT_FILE= nm-linux.h
NATDEPFILES= sparc-nat.o sparc64-nat.o sparc-sol2-nat.o sparc64-linux-nat.o \
corelow.o core-regset.o \
- fork-child.o inf-ptrace.o infptrace.o inftarg.o \
+ fork-child.o inf-ptrace.o \
proc-service.o linux-thread-db.o \
gcore.o linux-nat.o
^ permalink raw reply [flat|nested] 14+ messages in thread
* [committed] s390 watchpoints (Re: [RFC/RFA] Target vectors for native Linux targets)
2005-09-10 18:13 ` Daniel Jacobowitz
@ 2005-09-11 22:02 ` Ulrich Weigand
2005-09-11 23:09 ` Daniel Jacobowitz
0 siblings, 1 reply; 14+ messages in thread
From: Ulrich Weigand @ 2005-09-11 22:02 UTC (permalink / raw)
To: Daniel Jacobowitz
Cc: Ulrich Weigand, Mark Kettenis, manjo, gdb-patches, Jeff Johnston,
David Mosberger
Daniel Jacobowitz wrote:
> Here's what I'm checking in, in the interests of progress. I'll be
> glad to help with any problems it causes, including the ia64 corefile
> issue.
Thanks, Dan!
This implements the s390 watchpoint bits. I've also removed KERNEL_U_SIZE
-which is no longer used anywhere- and PTRACE_ARG3_TYPE and PTRACE_XFER_TYPE
-which are picked up by autoconf tests- from config/s390/nm-linux.h, making
that file empty except for the FETCH_INFERIOR_REGISTERS define.
Tested on s390-ibm-linux and s390x-ibm-linux, applied to mainline.
Bye,
Ulrich
ChangeLog:
* config/s390/nm-linux.h (KERNEL_U_SIZE): Remove.
(PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Likewise.
(s390_stopped_by_watchpoint, s390_insert_watchpoint,
s390_remove_watchpoint, TARGET_CAN_USE_HARDWARE_WATCHPOINT,
TARGET_REGION_OK_FOR_HW_WATCHPOINT, HAVE_CONTINUABLE_WATCHPOINT,
STOPPED_BY_WATCHPOINT, target_insert_watchpoint,
target_remove_watchpoint): Likewise.
* s390-nat.c: Remove include of <sys/user.h>.
(kernel_u_size): Remove.
(s390_stopped_by_watchpoint): Make static.
(s390_insert_watchpoint, s390_remove_watchpoint): Likewise.
(s390_can_use_hw_breakpoint): New function.
(s390_region_size_ok_for_hw_watchpoint): Likewise.
(_initialize_s390_nat): Add watchpoint methods to target.
diff -ur gdb-head/gdb.orig/config/s390/nm-linux.h gdb-head/gdb/config/s390/nm-linux.h
--- gdb-head/gdb.orig/config/s390/nm-linux.h 2004-09-13 16:06:04.000000000 +0200
+++ gdb-head/gdb/config/s390/nm-linux.h 2005-09-06 16:38:51.000000000 +0200
@@ -30,33 +30,7 @@
/* ptrace access. */
-#define PTRACE_ARG3_TYPE long
-#define PTRACE_XFER_TYPE long
-
#define FETCH_INFERIOR_REGISTERS
-#define KERNEL_U_SIZE kernel_u_size()
-extern int kernel_u_size (void);
-
-
-/* Hardware watchpoints. */
-
-extern int s390_stopped_by_watchpoint (void);
-extern int s390_insert_watchpoint (CORE_ADDR addr, int len);
-extern int s390_remove_watchpoint (CORE_ADDR addr, int len);
-
-#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
-#define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) 1
-#define HAVE_CONTINUABLE_WATCHPOINT 1
-
-#define STOPPED_BY_WATCHPOINT(w) \
- s390_stopped_by_watchpoint ()
-
-#define target_insert_watchpoint(addr, len, type) \
- s390_insert_watchpoint (addr, len)
-
-#define target_remove_watchpoint(addr, len, type) \
- s390_remove_watchpoint (addr, len)
-
#endif /* nm_linux.h */
diff -ur gdb-head/gdb.orig/s390-nat.c gdb-head/gdb/s390-nat.c
--- gdb-head/gdb.orig/s390-nat.c 2005-09-05 19:05:27.000000000 +0200
+++ gdb-head/gdb/s390-nat.c 2005-09-06 16:39:45.000000000 +0200
@@ -34,7 +34,6 @@
#include <sys/ptrace.h>
#include <asm/types.h>
#include <sys/procfs.h>
-#include <sys/user.h>
#include <sys/ucontext.h>
@@ -250,7 +249,7 @@
static struct watch_area *watch_base = NULL;
-int
+static int
s390_stopped_by_watchpoint (void)
{
per_lowcore_bits per_lowcore;
@@ -310,7 +309,7 @@
perror_with_name (_("Couldn't modify watchpoint status"));
}
-int
+static int
s390_insert_watchpoint (CORE_ADDR addr, int len)
{
struct watch_area *area = xmalloc (sizeof (struct watch_area));
@@ -327,7 +326,7 @@
return 0;
}
-int
+static int
s390_remove_watchpoint (CORE_ADDR addr, int len)
{
struct watch_area *area, **parea;
@@ -352,13 +351,19 @@
return 0;
}
+static int
+s390_can_use_hw_breakpoint (int type, int cnt, int othertype)
+{
+ return 1;
+}
-int
-kernel_u_size (void)
+static int
+s390_region_size_ok_for_hw_watchpoint (int cnt)
{
- return sizeof (struct user);
+ return 1;
}
+
void _initialize_s390_nat (void);
void
@@ -373,6 +378,14 @@
t->to_fetch_registers = s390_linux_fetch_inferior_registers;
t->to_store_registers = s390_linux_store_inferior_registers;
+ /* Add our watchpoint methods. */
+ t->to_can_use_hw_breakpoint = s390_can_use_hw_breakpoint;
+ t->to_region_size_ok_for_hw_watchpoint = s390_region_size_ok_for_hw_watchpoint;
+ t->to_have_continuable_watchpoint = 1;
+ t->to_stopped_by_watchpoint = s390_stopped_by_watchpoint;
+ t->to_insert_watchpoint = s390_insert_watchpoint;
+ t->to_remove_watchpoint = s390_remove_watchpoint;
+
/* Register the target. */
add_target (t);
}
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [committed] s390 watchpoints (Re: [RFC/RFA] Target vectors for native Linux targets)
2005-09-11 22:02 ` [committed] s390 watchpoints (Re: [RFC/RFA] Target vectors for native Linux targets) Ulrich Weigand
@ 2005-09-11 23:09 ` Daniel Jacobowitz
0 siblings, 0 replies; 14+ messages in thread
From: Daniel Jacobowitz @ 2005-09-11 23:09 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: Mark Kettenis, manjo, gdb-patches
On Mon, Sep 12, 2005 at 12:01:36AM +0200, Ulrich Weigand wrote:
> Daniel Jacobowitz wrote:
>
> > Here's what I'm checking in, in the interests of progress. I'll be
> > glad to help with any problems it causes, including the ia64 corefile
> > issue.
>
> Thanks, Dan!
>
> This implements the s390 watchpoint bits. I've also removed KERNEL_U_SIZE
> -which is no longer used anywhere- and PTRACE_ARG3_TYPE and PTRACE_XFER_TYPE
> -which are picked up by autoconf tests- from config/s390/nm-linux.h, making
> that file empty except for the FETCH_INFERIOR_REGISTERS define.
>
> Tested on s390-ibm-linux and s390x-ibm-linux, applied to mainline.
Beautiful. Someone needs to go through and take another look at
FETCH_INFERIOR_REGISTERS; I don't know when I'll get round to it,
but I will eventually.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFC] GDB patches for hw watchpoints
2005-08-17 18:30 [RFC] GDB patches for hw watchpoints Manoj Iyer
2005-08-17 18:46 ` Eli Zaretskii
2005-08-17 23:03 ` Mark Kettenis
@ 2005-09-18 1:20 ` Daniel Jacobowitz
2 siblings, 0 replies; 14+ messages in thread
From: Daniel Jacobowitz @ 2005-09-18 1:20 UTC (permalink / raw)
To: Manoj Iyer; +Cc: gdb-patches
On Wed, Aug 17, 2005 at 12:27:46PM -0500, Manoj Iyer wrote:
>
> I am submitting this patch on behalf of Ben Elliston <bje@au1.ibm.com>,
> this patch implements hardware watchpoints on PPC platform. Please review
> and comment, so I can commit.
>
> 2005-05-04 Ben Elliston <bje@au.ibm.com>
>
> * config/powerpc/nm-linux.h
> (HAVE_NONSTEPPABLE_WATCHPOINT): Define.
> (TARGET_REGION_OK_FOR_HW_WATCHPOINT): Likewise.
> (TARGET_CAN_USE_HARDWARE_WATCHPOINT): Likewise.
> (STOPPED_BY_WATCHPOINT): Likewise.
> (target_insert_watchpoint): Likewise.
> (target_remove_watchpoint): Likewise.
> (ppc_linux_insert_watchpoint): Declare.
> (ppc_linux_remove_watchpoint): Likewise.
> * ppc-linux-nat.c (PTRACE_GET_DEBUGREG): Define, if not already.
> (PTRACE_SET_DEBUGREG): Likewise.
> (PTRACE_GETSINGOINFO): Likewise.
> (ppc_linux_insert_watchpoint): New.
> (ppc_linux_remove_watchpoint): Likewise.
> (ppc_linux_stopped_by_watchpoint): Likewise.
> (ppc_linux_check_watch_resources): Likewise.
Mark raised a valid concern about the use of the NM file for this;
the problem has now been fixed, so you can do this without touching
nm-linux.h.
Eli asked a valid question about how the entire process works.
Also, I had trouble believing that this interface was sufficiently
portable among the many PowerPC variants (which have at least two
different debug register schemes), so I went and checked. Support for
these ptrace operations is not in the kernel.org kernel. Where is it,
and how's it supposed to work?
> + errno = 0;
> + ptrace (PTRACE_GETSIGINFO, tid, (PTRACE_TYPE_ARG3) 0, &siginfo);
> +
> + if (errno != 0 || siginfo.si_signo != SIGTRAP ||
> + (siginfo.si_code & 0xffff) != 0x0004)
> + return 0;
Hmm, if you're using siginfos for this, then at least some PPCs ought to
be able to tell you where the fault occured.
> +int
> +ppc_linux_check_watch_resources (int type, int cnt, int ot)
> +{
> + /* PPC has one DABR (hardware watchpoint) register. */
> + return (cnt <= 1);
> +}
Some have none. I don't know what other variations there may be.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2005-09-18 1:20 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-17 18:30 [RFC] GDB patches for hw watchpoints Manoj Iyer
2005-08-17 18:46 ` Eli Zaretskii
2005-08-17 23:03 ` Mark Kettenis
2005-08-19 0:53 ` [RFC/RFA] Target vectors for native Linux targets Ulrich Weigand
2005-08-21 10:48 ` Mark Kettenis
2005-08-21 15:21 ` Ulrich Weigand
2005-08-21 15:53 ` Mark Kettenis
2005-09-04 15:48 ` Daniel Jacobowitz
2005-09-04 22:48 ` Daniel Jacobowitz
2005-09-05 17:32 ` Ulrich Weigand
2005-09-10 18:13 ` Daniel Jacobowitz
2005-09-11 22:02 ` [committed] s390 watchpoints (Re: [RFC/RFA] Target vectors for native Linux targets) Ulrich Weigand
2005-09-11 23:09 ` Daniel Jacobowitz
2005-09-18 1:20 ` [RFC] GDB patches for hw watchpoints Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox