Browse Source
(remote-st.o, uw-thread.o): Delete. (HFILES_NO_SRCDIR, ALLDEPFILES): Update. * configure.host: Move hppa*-*-hiux*, i[34567]86-ncr-*, i[34567]86-*-dgux*, i[34567]86-*-lynxos*, i[34567]86-*-sco3.2v5*, i[34567]86-*-sco3.2v4*, i[34567]86-*-sco*, i[34567]86-*-sysv4.2*, i[34567]86-*-sysv4*, i[34567]86-*-sysv5*, i[34567]86-*-unixware2*, i[34567]86-*-unixware*, i[34567]86-*-sysv*, i[34567]86-*-isc*, and rs6000-*-lynxos* to an obsoletion stanza. * configure.tgt: Move hppa*-*-hiux*, i[34567]86-ncr-*, i[34567]86-*-lynxos*, m68*-cisco*-*, m68*-tandem-*, m68*-*-os68k*, and rs6000-*-lynxos* to an obsoletion stanza. Do not mention i[34567]86-*-netware*. * NEWS: Mention deleted targets. * coff-solib.c, coff-solib.h, i386v-nat.c, lynx-nat.c, remote-st.c, uw-thread.c, config/nm-lynx.h, config/i386/i386sco.mh, config/i386/i386sco4.mh, config/i386/i386sco5.mh, config/i386/i386v.mh, config/i386/i386v4.mh, config/i386/i386v42mp.mh, config/i386/ncr3000.mh, config/i386/ncr3000.mt, config/i386/nm-i386sco.h, config/i386/nm-i386sco4.h, config/i386/nm-i386sco5.h, config/i386/nm-i386v.h, config/i386/nm-i386v4.h, config/i386/nm-i386v42mp.h, config/m68k/cisco.mt, config/m68k/os68k.mt, config/m68k/st2000.mt, config/m68k/tm-cisco.h, config/m68k/tm-os68k.h, config/rs6000/rs6000lynx.mh, config/rs6000/rs6000lynx.mt, config/rs6000/tm-rs6000ly.h: Delete files.drow-reverse-20070409-branch
34 changed files with 95 additions and 3713 deletions
@ -1,135 +0,0 @@ |
|||
/* Handle COFF SVR3 shared libraries for GDB, the GNU Debugger.
|
|||
Copyright (C) 1993, 1994, 1998, 1999, 2000, 2007 |
|||
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., 51 Franklin Street, Fifth Floor, |
|||
Boston, MA 02110-1301, USA. */ |
|||
|
|||
|
|||
#include "defs.h" |
|||
|
|||
#include "frame.h" |
|||
#include "bfd.h" |
|||
#include "gdbcore.h" |
|||
#include "symtab.h" |
|||
#include "symfile.h" |
|||
#include "objfiles.h" |
|||
|
|||
/*
|
|||
|
|||
GLOBAL FUNCTION |
|||
|
|||
coff_solib_add -- add a shared library files to the symtab list. We |
|||
examine the `.lib' section of the exec file and determine the names of |
|||
the shared libraries. |
|||
|
|||
This function is responsible for discovering those names and |
|||
addresses, and saving sufficient information about them to allow |
|||
their symbols to be read at a later time. |
|||
|
|||
SYNOPSIS |
|||
|
|||
void coff_solib_add (char *arg_string, int from_tty, |
|||
struct target_ops *target, int readsyms) |
|||
|
|||
DESCRIPTION |
|||
|
|||
*/ |
|||
|
|||
void |
|||
coff_solib_add (char *arg_string, int from_tty, struct target_ops *target, int readsyms) |
|||
{ |
|||
asection *libsect; |
|||
|
|||
if (!readsyms) |
|||
return; |
|||
|
|||
libsect = bfd_get_section_by_name (exec_bfd, ".lib"); |
|||
|
|||
if (libsect) |
|||
{ |
|||
int libsize; |
|||
unsigned char *lib; |
|||
struct libent |
|||
{ |
|||
bfd_byte len[4]; |
|||
bfd_byte nameoffset[4]; |
|||
}; |
|||
|
|||
libsize = bfd_section_size (exec_bfd, libsect); |
|||
|
|||
lib = (unsigned char *) alloca (libsize); |
|||
|
|||
bfd_get_section_contents (exec_bfd, libsect, lib, 0, libsize); |
|||
|
|||
while (libsize > 0) |
|||
{ |
|||
struct libent *ent; |
|||
struct objfile *objfile; |
|||
int len, nameoffset; |
|||
char *filename; |
|||
|
|||
ent = (struct libent *) lib; |
|||
|
|||
len = bfd_get_32 (exec_bfd, ent->len); |
|||
|
|||
nameoffset = bfd_get_32 (exec_bfd, ent->nameoffset); |
|||
|
|||
if (len <= 0) |
|||
break; |
|||
|
|||
filename = (char *) ent + nameoffset * 4; |
|||
|
|||
objfile = symbol_file_add (filename, from_tty, |
|||
NULL, /* no offsets */ |
|||
0, /* not mainline */ |
|||
OBJF_SHARED); /* flags */ |
|||
|
|||
libsize -= len * 4; |
|||
lib += len * 4; |
|||
} |
|||
|
|||
/* Getting new symbols may change our opinion about what is
|
|||
frameless. */ |
|||
reinit_frame_cache (); |
|||
} |
|||
} |
|||
|
|||
/*
|
|||
|
|||
GLOBAL FUNCTION |
|||
|
|||
coff_solib_create_inferior_hook -- shared library startup support |
|||
|
|||
SYNOPSIS |
|||
|
|||
void coff_solib_create_inferior_hook () |
|||
|
|||
DESCRIPTION |
|||
|
|||
When gdb starts up the inferior, the kernel maps in the shared |
|||
libraries. We get here with the target stopped at it's first |
|||
instruction, and the libraries already mapped. At this point, this |
|||
function gets called via expansion of the macro |
|||
SOLIB_CREATE_INFERIOR_HOOK. |
|||
*/ |
|||
|
|||
void |
|||
coff_solib_create_inferior_hook (void) |
|||
{ |
|||
coff_solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add); |
|||
} |
|||
@ -1,187 +0,0 @@ |
|||
/* COFF (SVR3) Shared library declarations for GDB, the GNU Debugger.
|
|||
Copyright (C) 1992, 1993, 1998, 1999, 2000, 2003, 2007 |
|||
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., 51 Franklin Street, Fifth Floor, |
|||
Boston, MA 02110-1301, USA. */ |
|||
|
|||
/* Forward decl's for prototypes */ |
|||
struct target_ops; |
|||
|
|||
/* Called when we free all symtabs, to free the shared library information
|
|||
as well. */ |
|||
|
|||
#if 0 |
|||
#define CLEAR_SOLIB coff_clear_solib |
|||
|
|||
extern void coff_clear_solib (void); |
|||
#endif |
|||
|
|||
/* Called to add symbols from a shared library to gdb's symbol table. */ |
|||
|
|||
#define SOLIB_ADD(filename, from_tty, targ, readsyms) \ |
|||
coff_solib_add (filename, from_tty, targ, readsyms) |
|||
|
|||
extern void coff_solib_add (char *, int, struct target_ops *, int); |
|||
|
|||
/* Function to be called when the inferior starts up, to discover the
|
|||
names of shared libraries that are dynamically linked, the base |
|||
addresses to which they are linked, and sufficient information to |
|||
read in their symbols at a later time. */ |
|||
|
|||
#define SOLIB_CREATE_INFERIOR_HOOK(PID) coff_solib_create_inferior_hook () |
|||
|
|||
extern void coff_solib_create_inferior_hook (void); /* solib.c */ |
|||
|
|||
/* Function to be called to remove the connection between debugger and
|
|||
dynamic linker that was established by SOLIB_CREATE_INFERIOR_HOOK. |
|||
(This operation does not remove shared library information from |
|||
the debugger, as CLEAR_SOLIB does.) |
|||
|
|||
This functionality is presently not implemented for this target. |
|||
*/ |
|||
#define SOLIB_REMOVE_INFERIOR_HOOK(PID) (0) |
|||
|
|||
/* This function is called by the "catch load" command. It allows
|
|||
the debugger to be notified by the dynamic linker when a specified |
|||
library file (or any library file, if filename is NULL) is loaded. |
|||
|
|||
Presently, this functionality is not implemented. |
|||
*/ |
|||
#define SOLIB_CREATE_CATCH_LOAD_HOOK(pid, tempflag, filename, cond_string) \ |
|||
error (_("catch of library loads/unloads not yet implemented on this platform")) |
|||
|
|||
/* This function is called by the "catch unload" command. It allows
|
|||
the debugger to be notified by the dynamic linker when a specified |
|||
library file (or any library file, if filename is NULL) is unloaded. |
|||
|
|||
Presently, this functionality is not implemented. |
|||
*/ |
|||
#define SOLIB_CREATE_CATCH_UNLOAD_HOOK(pid, tempflag, filename, cond_string) \ |
|||
error (_("catch of library loads/unloads not yet implemented on this platform")) |
|||
|
|||
/* This function returns TRUE if the dynamic linker has just reported
|
|||
a load of a library. |
|||
|
|||
This function must be used only when the inferior has stopped in |
|||
the dynamic linker hook, or undefined results are guaranteed. |
|||
|
|||
Presently, this functionality is not implemented. |
|||
*/ |
|||
/*
|
|||
#define SOLIB_HAVE_LOAD_EVENT(pid) \ |
|||
error("catch of library loads/unloads not yet implemented on this platform") |
|||
*/ |
|||
|
|||
#define SOLIB_HAVE_LOAD_EVENT(pid) \ |
|||
(0) |
|||
|
|||
/* This function returns a pointer to the string representation of the
|
|||
pathname of the dynamically-linked library that has just been loaded. |
|||
|
|||
This function must be used only when SOLIB_HAVE_LOAD_EVENT is TRUE, |
|||
or undefined results are guaranteed. |
|||
|
|||
This string's contents are only valid immediately after the inferior |
|||
has stopped in the dynamic linker hook, and becomes invalid as soon |
|||
as the inferior is continued. Clients should make a copy of this |
|||
string if they wish to continue the inferior and then access the string. |
|||
|
|||
Presently, this functionality is not implemented. |
|||
*/ |
|||
|
|||
/*
|
|||
#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \ |
|||
error("catch of library loads/unloads not yet implemented on this platform") |
|||
*/ |
|||
|
|||
#define SOLIB_LOADED_LIBRARY_PATHNAME(pid) \ |
|||
"" |
|||
|
|||
/* This function returns TRUE if the dynamic linker has just reported
|
|||
an unload of a library. |
|||
|
|||
This function must be used only when the inferior has stopped in |
|||
the dynamic linker hook, or undefined results are guaranteed. |
|||
|
|||
Presently, this functionality is not implemented. |
|||
*/ |
|||
/*
|
|||
#define SOLIB_HAVE_UNLOAD_EVENT(pid) \ |
|||
error("catch of library loads/unloads not yet implemented on this platform") |
|||
*/ |
|||
|
|||
#define SOLIB_HAVE_UNLOAD_EVENT(pid) \ |
|||
(0) |
|||
|
|||
/* This function returns a pointer to the string representation of the
|
|||
pathname of the dynamically-linked library that has just been unloaded. |
|||
|
|||
This function must be used only when SOLIB_HAVE_UNLOAD_EVENT is TRUE, |
|||
or undefined results are guaranteed. |
|||
|
|||
This string's contents are only valid immediately after the inferior |
|||
has stopped in the dynamic linker hook, and becomes invalid as soon |
|||
as the inferior is continued. Clients should make a copy of this |
|||
string if they wish to continue the inferior and then access the string. |
|||
|
|||
Presently, this functionality is not implemented. |
|||
*/ |
|||
/*
|
|||
#define SOLIB_UNLOADED_LIBRARY_PATHNAME(pid) \ |
|||
error("catch of library loads/unloads not yet implemented on this platform") |
|||
*/ |
|||
|
|||
#define SOLIB_UNLOADED_LIBRARY_PATHNAME(pid) \ |
|||
"" |
|||
|
|||
/* This function returns TRUE if pc is the address of an instruction that
|
|||
lies within the dynamic linker (such as the event hook, or the dld |
|||
itself). |
|||
|
|||
This function must be used only when a dynamic linker event has been |
|||
caught, and the inferior is being stepped out of the hook, or undefined |
|||
results are guaranteed. |
|||
|
|||
Presently, this functionality is not implemented. |
|||
*/ |
|||
|
|||
/*
|
|||
#define SOLIB_IN_DYNAMIC_LINKER(pid,pc) \ |
|||
error("catch of library loads/unloads not yet implemented on this platform") |
|||
*/ |
|||
|
|||
#define SOLIB_IN_DYNAMIC_LINKER(pid,pc) \ |
|||
(0) |
|||
|
|||
/* This function must be called when the inferior is killed, and the program
|
|||
restarted. This is not the same as CLEAR_SOLIB, in that it doesn't discard |
|||
any symbol tables. |
|||
|
|||
Presently, this functionality is not implemented. |
|||
*/ |
|||
#define SOLIB_RESTART() \ |
|||
(0) |
|||
|
|||
/* If we can't set a breakpoint, and it's in a shared library, just
|
|||
disable it. */ |
|||
|
|||
#if 0 |
|||
#define DISABLE_UNSETTABLE_BREAK(addr) coff_solib_address(addr) |
|||
|
|||
extern int solib_address (CORE_ADDR); /* solib.c */ |
|||
#endif |
|||
@ -1,4 +0,0 @@ |
|||
# Host: Intel 386 running SCO Unix (pre-SVR4) |
|||
|
|||
NAT_FILE= nm-i386sco.h |
|||
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o i386v-nat.o |
|||
@ -1,4 +0,0 @@ |
|||
# Host: Intel 386 running SCO Unix 3.2v4 |
|||
|
|||
NAT_FILE= nm-i386sco4.h |
|||
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o i386v-nat.o |
|||
@ -1,7 +0,0 @@ |
|||
# Host: Intel 386 running SCO OpenServer 5 |
|||
# Much like 3.2v4, except we don't have to avoid problems with const |
|||
|
|||
NAT_FILE= nm-i386sco5.h |
|||
NATDEPFILES= infptrace.o inftarg.o fork-child.o corefile.o core-aout.o \ |
|||
corelow.o i386v-nat.o solib.o solib-svr4.o solib-legacy.o |
|||
|
|||
@ -1,4 +0,0 @@ |
|||
# Host: Intel 386 running System V |
|||
|
|||
NAT_FILE= nm-i386v.h |
|||
NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o core-aout.o i386v-nat.o |
|||
@ -1,6 +0,0 @@ |
|||
# Host: Intel 386 running SVR4 |
|||
|
|||
NAT_FILE= nm-i386v4.h |
|||
NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o \ |
|||
solib.o solib-svr4.o solib-legacy.o \ |
|||
procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o |
|||
@ -1,16 +0,0 @@ |
|||
# Host: Intel 386 running SVR4 |
|||
|
|||
# we don't want nm-i386v4.h since that defines LOSING_POLL which isn't |
|||
# appropriate for i386v42mp |
|||
NAT_FILE= nm-i386v42mp.h |
|||
|
|||
# NATDEPFILES must remain entirely on one line. When building a cross |
|||
# debugger, configure will cause this line to be commented out in the |
|||
# Makefile. Many non-GNU versions of make don't permit the use of a |
|||
# continuation character (backslash) to extend a commented line. As a |
|||
# consequence, make considers subsequent tab-indented lines to be |
|||
# some sort of error. |
|||
NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o \ |
|||
gcore.o solib.o solib-svr4.o solib-legacy.o procfs.o proc-api.o \ |
|||
proc-events.o proc-flags.o proc-why.o uw-thread.o |
|||
|
|||
@ -1,5 +0,0 @@ |
|||
# Host: NCR 3000 (Intel 386 running SVR4) |
|||
|
|||
NAT_FILE= nm-i386v4.h |
|||
NATDEPFILES= corelow.o core-regset.o fork-child.o i386v4-nat.o procfs.o \ |
|||
proc-api.o proc-events.o proc-flags.o proc-why.o |
|||
@ -1,2 +0,0 @@ |
|||
# Target: Intel 386 running SVR4 |
|||
TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o solib-legacy.o |
|||
@ -1,33 +0,0 @@ |
|||
/* Native support for i386.
|
|||
Copyright 1986, 1987, 1989, 1992, 1994, 1998, 2000, 2007 |
|||
Free Software Foundation, Inc. |
|||
Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu), July 1988. |
|||
|
|||
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. */ |
|||
|
|||
#ifndef NM_I386SCO_H |
|||
#define NM_I386SCO_H |
|||
|
|||
#include "i386/nm-i386v.h" |
|||
|
|||
/* When calling functions on SCO, sometimes we get an error writing some
|
|||
of the segment registers. This would appear to be a kernel |
|||
bug/non-feature. */ |
|||
#define CANNOT_STORE_REGISTER(regno) ((regno) == 14 || (regno) == 15) |
|||
|
|||
#endif /* nm-i386sco.h */ |
|||
@ -1,31 +0,0 @@ |
|||
/* Native support for SCO 3.2v4.
|
|||
Copyright 1993, 2007 Free Software Foundation, Inc. |
|||
Contributed by Cygnus Support. By Ian Lance Taylor |
|||
<ian@cygnus.com> based on work by Martin Walker <maw@netcom.com>. |
|||
|
|||
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. */ |
|||
|
|||
/* SCO 3.2v4 is actually just like SCO 3.2v2, except that it
|
|||
additionally supports attaching to a process. */ |
|||
|
|||
#include "i386/nm-i386sco.h" |
|||
|
|||
/* SCO, in its wisdom, does not provide <sys/ptrace.h>. infptrace.c
|
|||
does not have defaults for these values. */ |
|||
#define PTRACE_ATTACH 10 |
|||
#define PTRACE_DETACH 11 |
|||
@ -1,71 +0,0 @@ |
|||
/* Native support for SCO OpenServer 5.
|
|||
Copyright 1996, 1998, 2002, 2007 Free Software Foundation, Inc. |
|||
Re-written by J. Kean Johnston <jkj@sco.com>. |
|||
Originally written by Robert Lipe <robertl@dgii.com>, based on |
|||
work by Ian Lance Taylor <ian@cygnus.com> and |
|||
Martin Walker <maw@netcom.com>. |
|||
|
|||
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. */ |
|||
|
|||
#ifndef NM_I386SCO5_H |
|||
#define NM_I386SCO5_H |
|||
|
|||
/* Basically, its a lot like the older versions ... */ |
|||
#include "i386/nm-i386sco.h" |
|||
|
|||
/* SCO is unlike other SVR4 systems in that it has SVR4 style shared
|
|||
libs, with a slight twist. We expect 3 traps (2 for the exec and |
|||
one for the dynamic loader). After the third trap we insert the |
|||
shared library breakpoints, then wait for the 4th trap. */ |
|||
|
|||
#undef START_INFERIOR_TRAPS_EXPECTED |
|||
#define START_INFERIOR_TRAPS_EXPECTED 3 |
|||
|
|||
/* SCO does not provide <sys/ptrace.h>. However, infptrace.c does not
|
|||
have defaults for these values. */ |
|||
|
|||
#define PTRACE_ATTACH 10 |
|||
#define PTRACE_DETACH 11 |
|||
|
|||
/* Return the size of the user struct. */ |
|||
|
|||
#define KERNEL_U_SIZE kernel_u_size () |
|||
extern int kernel_u_size (void); |
|||
|
|||
/* Hardware-assisted breakpoints and watchpoints. */ |
|||
|
|||
/* We can also do hardware watchpoints. */ |
|||
#define TARGET_HAS_HARDWARE_WATCHPOINTS |
|||
#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1 |
|||
|
|||
/* After a watchpoint trap, the PC points to the instruction which
|
|||
caused the trap. But we can continue over it without disabling the |
|||
trap. */ |
|||
#define HAVE_CONTINUABLE_WATCHPOINT 1 |
|||
#define HAVE_STEPPABLE_WATCHPOINT |
|||
|
|||
#define STOPPED_BY_WATCHPOINT(W) \ |
|||
i386_stopped_by_watchpoint (PIDGET (inferior_ptid)) |
|||
|
|||
#define target_insert_watchpoint(addr, len, type) \ |
|||
i386_insert_watchpoint (PIDGET (inferior_ptid), addr, len, type) |
|||
|
|||
#define target_remove_watchpoint(addr, len, type) \ |
|||
i386_remove_watchpoint (PIDGET (inferior_ptid), addr, len) |
|||
|
|||
#endif /* nm-i386sco5.h */ |
|||
@ -1,47 +0,0 @@ |
|||
/* Native support for i386 running System V (pre-SVR4).
|
|||
|
|||
Copyright 1986, 1987, 1989, 1992, 1993, 1998, 2000, 2002, 2007 |
|||
Free Software Foundation, Inc. |
|||
Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu), July 1988. |
|||
|
|||
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. */ |
|||
|
|||
#ifndef NM_I386V_H |
|||
#define NM_I386V_H |
|||
|
|||
/* Support for the user struct. */ |
|||
|
|||
/* This is the amount to subtract from u.u_ar0
|
|||
to get the offset in the core file of the register values. */ |
|||
|
|||
#define REGISTER_U_ADDR(addr, blockend, regnum) \ |
|||
(addr) = register_u_addr ((blockend), (regnum)) |
|||
extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regnum); |
|||
|
|||
/* This is the amount to subtract from u.u_ar0
|
|||
to get the offset in the core file of the register values. */ |
|||
#define KERNEL_U_ADDR 0xe0000000 |
|||
|
|||
/* Number of traps that happen between exec'ing the shell to run an
|
|||
inferior, and when we finally get to the inferior code. This is 2 |
|||
on most implementations. Override here to 4. */ |
|||
|
|||
#undef START_INFERIOR_TRAPS_EXPECTED |
|||
#define START_INFERIOR_TRAPS_EXPECTED 4 |
|||
|
|||
#endif /* nm-i386v.h */ |
|||
@ -1,29 +0,0 @@ |
|||
/* Native support for i386 running SVR4.
|
|||
Copyright 1986, 1987, 1989, 1992, 1993, 1996, 2007 |
|||
Free Software Foundation, Inc. |
|||
Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu), July 1988. |
|||
|
|||
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. */ |
|||
|
|||
/* SVR4 has /proc support, so use it instead of ptrace. */ |
|||
|
|||
#define USE_PROC_FS |
|||
|
|||
/* This is the amount to subtract from u.u_ar0
|
|||
to get the offset in the core file of the register values. */ |
|||
#define KERNEL_U_ADDR 0xe0000000 |
|||
@ -1,98 +0,0 @@ |
|||
/* Native support for i386 running SVR4.
|
|||
Copyright 1986, 1987, 1989, 1992, 1996, 1997, 1998, 2007 |
|||
Free Software Foundation, Inc. |
|||
Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu), July 1988. |
|||
|
|||
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. */ |
|||
|
|||
#ifndef NM_I386V42MP_H |
|||
#define NM_I386V42MP_H |
|||
|
|||
/* SVR4 has /proc support, so use it instead of ptrace. */ |
|||
|
|||
#define USE_PROC_FS |
|||
|
|||
/* define to select for other sysv4.2mp weirdness (see procfs.c) */ |
|||
|
|||
#define UNIXWARE |
|||
|
|||
#if 0 |
|||
/* The following macros extract process and lwp/thread ids from a
|
|||
composite id. |
|||
|
|||
For consistency with UnixWare core files, allocate bits 0-15 for |
|||
process ids and bits 16 and up for lwp ids. Reserve bit 31 for |
|||
negative return values to indicate exceptions, and use bit 30 as a |
|||
flag to indicate a user-mode thread, leaving 14 bits for lwp |
|||
ids. */ |
|||
|
|||
/* Number of bits in composite id allocated to process number. */ |
|||
#define PIDBITS 16 |
|||
|
|||
/* Return the process id stored in composite PID. */ |
|||
#define PIDGET(PID) (((PID) & ((1 << PIDBITS) - 1))) |
|||
|
|||
/* Return the thread or lwp id stored in composite PID. */ |
|||
#define TIDGET(PID) (((PID) & 0x3fffffff) >> PIDBITS) |
|||
#define LIDGET(PID) TIDGET(PID) |
|||
|
|||
/* Construct a composite id from lwp LID and the process portion of
|
|||
composite PID. */ |
|||
#define MERGEPID(PID, LID) (PIDGET(PID) | ((LID) << PIDBITS)) |
|||
#define MKLID(PID, LID) MERGEPID(PID, LID) |
|||
|
|||
/* Construct a composite id from thread TID and the process portion of
|
|||
composite PID. */ |
|||
#define MKTID(PID, TID) (MERGEPID(PID, TID) | 0x40000000) |
|||
|
|||
/* Return whether PID contains a user-space thread id. */ |
|||
#define ISTID(PID) ((PID) & 0x40000000) |
|||
#endif |
|||
|
|||
/* New definitions of the ptid stuff. Due to the way the
|
|||
code is structured in uw-thread.c, I'm overloading the thread id |
|||
and lwp id onto the lwp field. The tid field is used to indicate |
|||
whether the lwp is a tid or not. |
|||
|
|||
FIXME: Check that core file support is not broken. (See original |
|||
#if 0'd comments above.)
|
|||
FIXME: Restructure uw-thread.c so that the struct ptid fields |
|||
can be used as intended. */ |
|||
|
|||
/* Return the process id stored in composite PID. */ |
|||
#define PIDGET(PID) (ptid_get_pid (PID)) |
|||
|
|||
/* Return the thread or lwp id stored in composite PID. */ |
|||
#define TIDGET(PID) (ptid_get_lwp (PID)) |
|||
#define LIDGET(PID) TIDGET(PID) |
|||
|
|||
#define MERGEPID(PID, LID) (ptid_build ((PID), (LID), 0)) |
|||
#define MKLID(PID, LID) (ptid_build ((PID), (LID), 0)) |
|||
|
|||
/* Construct a composite id from thread TID and the process portion of
|
|||
composite PID. */ |
|||
#define MKTID(PID, TID) (ptid_build ((PID), (TID), 1)) |
|||
|
|||
/* Return whether PID contains a user-space thread id. */ |
|||
#define ISTID(PID) (ptid_get_tid (PID)) |
|||
|
|||
/* This is the amount to subtract from u.u_ar0
|
|||
to get the offset in the core file of the register values. */ |
|||
#define KERNEL_U_ADDR 0xe0000000 |
|||
|
|||
#endif /* NM_I386V42MP_H */ |
|||
@ -1,3 +0,0 @@ |
|||
# Target: Cisco Router with 68K processor |
|||
TDEPFILES= m68k-tdep.o corelow.o core-aout.o |
|||
DEPRECATED_TM_FILE= tm-cisco.h |
|||
@ -1,3 +0,0 @@ |
|||
# Target: os68k running on a 68000 |
|||
TDEPFILES= m68k-tdep.o |
|||
DEPRECATED_TM_FILE= tm-os68k.h |
|||
@ -1,2 +0,0 @@ |
|||
# Target: Tandem ST-2000 phone switch |
|||
TDEPFILES= m68k-tdep.o remote-st.o |
|||
@ -1,46 +0,0 @@ |
|||
/* Parameters for CISCO m68k.
|
|||
Copyright 1994, 1996, 2000, 2007 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. */ |
|||
|
|||
#define GDBINIT_FILENAME ".cisco-gdbinit" /* Init file */ |
|||
|
|||
#define DEFAULT_PROMPT "(cisco-68k-gdb) " /* Default prompt */ |
|||
|
|||
/* Offsets (in target ints) into jmp_buf. Defined in /csc/sys/sun/asm.S. */ |
|||
|
|||
#define JB_ELEMENT_SIZE 4 |
|||
|
|||
#define JB_PC 0 |
|||
#define JB_D2 1 |
|||
#define JB_D3 2 |
|||
#define JB_D4 3 |
|||
#define JB_D5 4 |
|||
#define JB_D6 5 |
|||
#define JB_D7 6 |
|||
#define JB_A2 7 |
|||
#define JB_A3 8 |
|||
#define JB_A4 9 |
|||
#define JB_A5 10 |
|||
#define JB_A6 11 |
|||
#define JB_SP 12 |
|||
|
|||
/* BFD handles finding the registers in the core file, so they are at
|
|||
the start of the BFD .reg section. */ |
|||
#define REGISTER_U_ADDR(addr,blockend,regno) (addr = DEPRECATED_REGISTER_BYTE (regno)) |
|||
#define KERNEL_U_ADDR 0 |
|||
@ -1,38 +0,0 @@ |
|||
/* Parameters for execution on os68k's, for GDB, the GNU debugger.
|
|||
Copyright 1986, 1987, 1989, 1991, 1998, 2003, 2007 |
|||
Free Software Foundation, Inc. |
|||
Contributed by Cygnus Support. |
|||
|
|||
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. */ |
|||
|
|||
#define GDBINIT_FILENAME ".os68gdbinit" |
|||
|
|||
#define DEFAULT_PROMPT "(os68k) " |
|||
|
|||
/* We have more complex, useful breakpoints on the target. */ |
|||
#undef DECR_PC_AFTER_BREAK |
|||
#define DECR_PC_AFTER_BREAK 0 |
|||
|
|||
/* Takes the current frame-struct pointer and returns the chain-pointer
|
|||
to get to the calling frame. |
|||
|
|||
If our current frame pointer is zero, we're at the top; else read out |
|||
the saved FP from memory pointed to by the current FP. */ |
|||
|
|||
#undef DEPRECATED_FRAME_CHAIN |
|||
#define DEPRECATED_FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0) |
|||
@ -1,92 +0,0 @@ |
|||
/* Native-dependent definitions for LynxOS.
|
|||
|
|||
Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2003, 2007 |
|||
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. */ |
|||
|
|||
#ifndef NM_LYNX_H |
|||
#define NM_LYNX_H |
|||
|
|||
struct target_waitstatus; |
|||
|
|||
#include <sys/conf.h> |
|||
#include <sys/kernel.h> |
|||
/* sys/kernel.h should define this, but doesn't always, sigh. */ |
|||
#ifndef __LYNXOS |
|||
#define __LYNXOS |
|||
#endif |
|||
#include <sys/mem.h> |
|||
#include <sys/signal.h> |
|||
#include <sys/time.h> |
|||
#include <sys/resource.h> |
|||
#include <sys/itimer.h> |
|||
#include <sys/file.h> |
|||
#include <sys/proc.h> |
|||
#include "gdbthread.h" |
|||
|
|||
/* Lynx's signal.h doesn't seem to have any macros for what signal numbers
|
|||
the real-time events are. */ |
|||
#define REALTIME_LO 33 |
|||
/* One more than the last one. */ |
|||
#define REALTIME_HI 64 |
|||
|
|||
/* This is the amount to subtract from u.u_ar0 to get the offset in
|
|||
the core file of the register values. */ |
|||
|
|||
#define KERNEL_U_ADDR USRSTACK |
|||
|
|||
/* As of LynxOS 2.2.2 (beta 8/15/94), this is int. Previous versions seem to
|
|||
have had no prototype, so I'm not sure why GDB used to define this to |
|||
char *. */ |
|||
#define PTRACE_ARG3_TYPE int |
|||
|
|||
/* Override copies of {fetch,store}_inferior_registers in infptrace.c. */ |
|||
|
|||
#define FETCH_INFERIOR_REGISTERS |
|||
|
|||
/* Thread ID of stopped thread. */ |
|||
|
|||
#define WIFTID(x) (((union wait *)&x)->w_tid) |
|||
|
|||
/* Override child_wait in inftarg.c */ |
|||
|
|||
#define CHILD_WAIT |
|||
|
|||
/* Override child_resume in infptrace.c */ |
|||
|
|||
#define DEPRECATED_CHILD_RESUME |
|||
|
|||
/* Override child_thread_alive in intarg.c */ |
|||
|
|||
#define CHILD_THREAD_ALIVE |
|||
|
|||
#include "target.h" |
|||
|
|||
extern ptid_t child_wait (ptid_t ptid, |
|||
struct target_waitstatus *status); |
|||
|
|||
/* Lynx needs a special definition of this so that we can
|
|||
print out the pid and thread number seperately. */ |
|||
|
|||
|
|||
/* override child_pid_to_str in inftarg.c */ |
|||
#define CHILD_PID_TO_STR |
|||
extern char *lynx_pid_to_str (ptid_t ptid); |
|||
|
|||
#endif /* NM_LYNX_H */ |
|||
@ -1,6 +0,0 @@ |
|||
# Host: RS6000 running LynxOS |
|||
|
|||
XM_CLIBS= -lbsd |
|||
|
|||
NAT_FILE= config/nm-lynx.h |
|||
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o lynx-nat.o xcoffread.o |
|||
@ -1,3 +0,0 @@ |
|||
# Target: IBM RS6000 running LynxOS |
|||
TDEPFILES= coff-solib.o xcoffread.o rs6000-tdep.o ppc-sysv-tdep.o solib.o solib-svr4.o |
|||
DEPRECATED_TM_FILE= tm-rs6000ly.h |
|||
@ -1,31 +0,0 @@ |
|||
/* Macro definitions for RS6000 running under LynxOS.
|
|||
Copyright 1993, 2000, 2007 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. */ |
|||
|
|||
#ifndef TM_RS6000LYNX_H |
|||
#define TM_RS6000LYNX_H |
|||
|
|||
#include "coff-solib.h" /* COFF shared library support */ |
|||
|
|||
/* Use generic RS6000 definitions. */ |
|||
#include "rs6000/tm-rs6000.h" |
|||
|
|||
#define CANNOT_STORE_REGISTER(regno) (regno == PS_REGNUM) |
|||
|
|||
#endif /* TM_RS6000LYNX_H */ |
|||
@ -1,273 +0,0 @@ |
|||
/* Intel 386 native support for System V systems (pre-SVR4).
|
|||
|
|||
Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, |
|||
2000, 2002, 2007 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., 51 Franklin Street, Fifth Floor, |
|||
Boston, MA 02110-1301, USA. */ |
|||
|
|||
#include "defs.h" |
|||
|
|||
#ifdef HAVE_PTRACE_H |
|||
#include <ptrace.h> |
|||
#else |
|||
#ifdef HAVE_SYS_PTRACE_H |
|||
#include <sys/ptrace.h> |
|||
#endif |
|||
#endif |
|||
|
|||
#include "frame.h" |
|||
#include "inferior.h" |
|||
#include "language.h" |
|||
#include "gdbcore.h" |
|||
|
|||
#include <sys/param.h> |
|||
#include <sys/dir.h> |
|||
#include <signal.h> |
|||
#include <sys/user.h> |
|||
#include <sys/ioctl.h> |
|||
#include <fcntl.h> |
|||
|
|||
#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS |
|||
#include <sys/debugreg.h> |
|||
#endif |
|||
|
|||
#include <sys/file.h> |
|||
#include "gdb_stat.h" |
|||
|
|||
#ifdef HAVE_SYS_REG_H |
|||
#include <sys/reg.h> |
|||
#endif |
|||
|
|||
#include "floatformat.h" |
|||
|
|||
#include "target.h" |
|||
|
|||
#include "i386-tdep.h" |
|||
|
|||
|
|||
/* Mapping between the general-purpose registers in `struct user'
|
|||
format and GDB's register array layout. */ |
|||
static int regmap[] = |
|||
{ |
|||
EAX, ECX, EDX, EBX, |
|||
UESP, EBP, ESI, EDI, |
|||
EIP, EFL, CS, SS, |
|||
DS, ES, FS, GS, |
|||
}; |
|||
|
|||
/* Support for the user struct. */ |
|||
|
|||
/* Return the address of register REGNUM. BLOCKEND is the value of
|
|||
u.u_ar0, and points to the place where GS is stored. */ |
|||
|
|||
CORE_ADDR |
|||
register_u_addr (CORE_ADDR blockend, int regnum) |
|||
{ |
|||
struct user u; |
|||
CORE_ADDR fpstate; |
|||
|
|||
if (i386_fp_regnum_p (regnum)) |
|||
{ |
|||
#ifdef KSTKSZ /* SCO, and others? */ |
|||
blockend += 4 * (SS + 1) - KSTKSZ; |
|||
fpstate = blockend + ((char *) &u.u_fps.u_fpstate - (char *) &u); |
|||
return (fpstate + 0x1c + 10 * (regnum - FP0_REGNUM)); |
|||
#else |
|||
fpstate = blockend + ((char *) &u.i387.st_space - (char *) &u); |
|||
return (fpstate + 10 * (regnum - FP0_REGNUM)); |
|||
#endif |
|||
} |
|||
|
|||
return (blockend + 4 * regmap[regnum]); |
|||
} |
|||
|
|||
/* Return the size of the user struct. */ |
|||
|
|||
int |
|||
kernel_u_size (void) |
|||
{ |
|||
return (sizeof (struct user)); |
|||
} |
|||
|
|||
#ifdef TARGET_HAS_HARDWARE_WATCHPOINTS |
|||
|
|||
#if !defined (offsetof) |
|||
#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER) |
|||
#endif |
|||
|
|||
/* Record the value of the debug control register. */ |
|||
static int debug_control_mirror; |
|||
|
|||
/* Record which address associates with which register. */ |
|||
static CORE_ADDR address_lookup[DR_LASTADDR - DR_FIRSTADDR + 1]; |
|||
|
|||
static int i386_insert_aligned_watchpoint (int, CORE_ADDR, CORE_ADDR, int, |
|||
int); |
|||
|
|||
static int i386_insert_nonaligned_watchpoint (int, CORE_ADDR, CORE_ADDR, int, |
|||
int); |
|||
|
|||
/* Insert a watchpoint. */ |
|||
|
|||
int |
|||
i386_insert_watchpoint (int pid, CORE_ADDR addr, int len, int rw) |
|||
{ |
|||
return i386_insert_aligned_watchpoint (pid, addr, addr, len, rw); |
|||
} |
|||
|
|||
static int |
|||
i386_insert_aligned_watchpoint (int pid, CORE_ADDR waddr, CORE_ADDR addr, |
|||
int len, int rw) |
|||
{ |
|||
int i; |
|||
int read_write_bits, len_bits; |
|||
int free_debug_register; |
|||
int register_number; |
|||
|
|||
/* Look for a free debug register. */ |
|||
for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) |
|||
{ |
|||
if (address_lookup[i - DR_FIRSTADDR] == 0) |
|||
break; |
|||
} |
|||
|
|||
/* No more debug registers! */ |
|||
if (i > DR_LASTADDR) |
|||
return -1; |
|||
|
|||
read_write_bits = (rw & 1) ? DR_RW_READ : DR_RW_WRITE; |
|||
|
|||
if (len == 1) |
|||
len_bits = DR_LEN_1; |
|||
else if (len == 2) |
|||
{ |
|||
if (addr % 2) |
|||
return i386_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw); |
|||
len_bits = DR_LEN_2; |
|||
} |
|||
|
|||
else if (len == 4) |
|||
{ |
|||
if (addr % 4) |
|||
return i386_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw); |
|||
len_bits = DR_LEN_4; |
|||
} |
|||
else |
|||
return i386_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw); |
|||
|
|||
free_debug_register = i; |
|||
register_number = free_debug_register - DR_FIRSTADDR; |
|||
debug_control_mirror |= |
|||
((read_write_bits | len_bits) |
|||
<< (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * register_number)); |
|||
debug_control_mirror |= |
|||
(1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * register_number)); |
|||
debug_control_mirror |= DR_LOCAL_SLOWDOWN; |
|||
debug_control_mirror &= ~DR_CONTROL_RESERVED; |
|||
|
|||
ptrace (6, pid, offsetof (struct user, u_debugreg[DR_CONTROL]), |
|||
debug_control_mirror); |
|||
ptrace (6, pid, offsetof (struct user, u_debugreg[free_debug_register]), |
|||
addr); |
|||
|
|||
/* Record where we came from. */ |
|||
address_lookup[register_number] = addr; |
|||
return 0; |
|||
} |
|||
|
|||
static int |
|||
i386_insert_nonaligned_watchpoint (int pid, CORE_ADDR waddr, CORE_ADDR addr, |
|||
int len, int rw) |
|||
{ |
|||
int align; |
|||
int size; |
|||
int rv; |
|||
|
|||
static int size_try_array[4][4] = |
|||
{ |
|||
{ 1, 1, 1, 1 }, /* trying size one */ |
|||
{ 2, 1, 2, 1 }, /* trying size two */ |
|||
{ 2, 1, 2, 1 }, /* trying size three */ |
|||
{ 4, 1, 2, 1 } /* trying size four */ |
|||
}; |
|||
|
|||
rv = 0; |
|||
while (len > 0) |
|||
{ |
|||
align = addr % 4; |
|||
/* Four is the maximum length for 386. */ |
|||
size = size_try_array[len > 4 ? 3 : len - 1][align]; |
|||
|
|||
rv = i386_insert_aligned_watchpoint (pid, waddr, addr, size, rw); |
|||
if (rv) |
|||
{ |
|||
i386_remove_watchpoint (pid, waddr, size); |
|||
return rv; |
|||
} |
|||
addr += size; |
|||
len -= size; |
|||
} |
|||
return rv; |
|||
} |
|||
|
|||
/* Remove a watchpoint. */ |
|||
|
|||
int |
|||
i386_remove_watchpoint (int pid, CORE_ADDR addr, int len) |
|||
{ |
|||
int i; |
|||
int register_number; |
|||
|
|||
for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) |
|||
{ |
|||
register_number = i - DR_FIRSTADDR; |
|||
if (address_lookup[register_number] == addr) |
|||
{ |
|||
debug_control_mirror &= |
|||
~(1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * register_number)); |
|||
address_lookup[register_number] = 0; |
|||
} |
|||
} |
|||
ptrace (6, pid, offsetof (struct user, u_debugreg[DR_CONTROL]), |
|||
debug_control_mirror); |
|||
ptrace (6, pid, offsetof (struct user, u_debugreg[DR_STATUS]), 0); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
/* Check if stopped by a watchpoint. */ |
|||
|
|||
CORE_ADDR |
|||
i386_stopped_by_watchpoint (int pid) |
|||
{ |
|||
int i; |
|||
int status; |
|||
|
|||
status = ptrace (3, pid, offsetof (struct user, u_debugreg[DR_STATUS]), 0); |
|||
ptrace (6, pid, offsetof (struct user, u_debugreg[DR_STATUS]), 0); |
|||
|
|||
for (i = DR_FIRSTADDR; i <= DR_LASTADDR; i++) |
|||
{ |
|||
if (status & (1 << (i - DR_FIRSTADDR))) |
|||
return address_lookup[i - DR_FIRSTADDR]; |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
#endif /* TARGET_HAS_HARDWARE_WATCHPOINTS */ |
|||
@ -1,624 +0,0 @@ |
|||
/* Native-dependent code for LynxOS.
|
|||
|
|||
Copyright (C) 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2003, 2007 |
|||
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., 51 Franklin Street, Fifth Floor, |
|||
Boston, MA 02110-1301, USA. */ |
|||
|
|||
#include "defs.h" |
|||
#include "frame.h" |
|||
#include "inferior.h" |
|||
#include "target.h" |
|||
#include "gdbcore.h" |
|||
#include "regcache.h" |
|||
|
|||
#include <sys/ptrace.h> |
|||
#Include "gdb_wait.h" |
|||
#include <sys/fpp.h> |
|||
|
|||
static unsigned long registers_addr (int pid); |
|||
static void fetch_core_registers (char *, unsigned, int, CORE_ADDR); |
|||
|
|||
#define X(ENTRY)(offsetof(struct econtext, ENTRY)) |
|||
|
|||
#ifdef I386 |
|||
/* Mappings from tm-i386v.h */ |
|||
|
|||
static int regmap[] = |
|||
{ |
|||
X (eax), |
|||
X (ecx), |
|||
X (edx), |
|||
X (ebx), |
|||
X (esp), /* sp */ |
|||
X (ebp), /* fp */ |
|||
X (esi), |
|||
X (edi), |
|||
X (eip), /* pc */ |
|||
X (flags), /* ps */ |
|||
X (cs), |
|||
X (ss), |
|||
X (ds), |
|||
X (es), |
|||
X (ecode), /* Lynx doesn't give us either fs or gs, so */ |
|||
X (fault), /* we just substitute these two in the hopes
|
|||
that they are useful. */ |
|||
}; |
|||
#endif /* I386 */ |
|||
|
|||
#ifdef M68K |
|||
/* Mappings from tm-m68k.h */ |
|||
|
|||
static int regmap[] = |
|||
{ |
|||
X (regs[0]), /* d0 */ |
|||
X (regs[1]), /* d1 */ |
|||
X (regs[2]), /* d2 */ |
|||
X (regs[3]), /* d3 */ |
|||
X (regs[4]), /* d4 */ |
|||
X (regs[5]), /* d5 */ |
|||
X (regs[6]), /* d6 */ |
|||
X (regs[7]), /* d7 */ |
|||
X (regs[8]), /* a0 */ |
|||
X (regs[9]), /* a1 */ |
|||
X (regs[10]), /* a2 */ |
|||
X (regs[11]), /* a3 */ |
|||
X (regs[12]), /* a4 */ |
|||
X (regs[13]), /* a5 */ |
|||
X (regs[14]), /* fp */ |
|||
offsetof (st_t, usp) - offsetof (st_t, ec), /* sp */ |
|||
X (status), /* ps */ |
|||
X (pc), |
|||
|
|||
X (fregs[0 * 3]), /* fp0 */ |
|||
X (fregs[1 * 3]), /* fp1 */ |
|||
X (fregs[2 * 3]), /* fp2 */ |
|||
X (fregs[3 * 3]), /* fp3 */ |
|||
X (fregs[4 * 3]), /* fp4 */ |
|||
X (fregs[5 * 3]), /* fp5 */ |
|||
X (fregs[6 * 3]), /* fp6 */ |
|||
X (fregs[7 * 3]), /* fp7 */ |
|||
|
|||
X (fcregs[0]), /* fpcontrol */ |
|||
X (fcregs[1]), /* fpstatus */ |
|||
X (fcregs[2]), /* fpiaddr */ |
|||
X (ssw), /* fpcode */ |
|||
X (fault), /* fpflags */ |
|||
}; |
|||
#endif /* M68K */ |
|||
|
|||
#ifdef SPARC |
|||
/* Mappings from tm-sparc.h */ |
|||
|
|||
#define FX(ENTRY)(offsetof(struct fcontext, ENTRY)) |
|||
|
|||
static int regmap[] = |
|||
{ |
|||
-1, /* g0 */ |
|||
X (g1), |
|||
X (g2), |
|||
X (g3), |
|||
X (g4), |
|||
-1, /* g5->g7 aren't saved by Lynx */ |
|||
-1, |
|||
-1, |
|||
|
|||
X (o[0]), |
|||
X (o[1]), |
|||
X (o[2]), |
|||
X (o[3]), |
|||
X (o[4]), |
|||
X (o[5]), |
|||
X (o[6]), /* sp */ |
|||
X (o[7]), /* ra */ |
|||
|
|||
-1, -1, -1, -1, -1, -1, -1, -1, /* l0 -> l7 */ |
|||
|
|||
-1, -1, -1, -1, -1, -1, -1, -1, /* i0 -> i7 */ |
|||
|
|||
FX (f.fregs[0]), /* f0 */ |
|||
FX (f.fregs[1]), |
|||
FX (f.fregs[2]), |
|||
FX (f.fregs[3]), |
|||
FX (f.fregs[4]), |
|||
FX (f.fregs[5]), |
|||
FX (f.fregs[6]), |
|||
FX (f.fregs[7]), |
|||
FX (f.fregs[8]), |
|||
FX (f.fregs[9]), |
|||
FX (f.fregs[10]), |
|||
FX (f.fregs[11]), |
|||
FX (f.fregs[12]), |
|||
FX (f.fregs[13]), |
|||
FX (f.fregs[14]), |
|||
FX (f.fregs[15]), |
|||
FX (f.fregs[16]), |
|||
FX (f.fregs[17]), |
|||
FX (f.fregs[18]), |
|||
FX (f.fregs[19]), |
|||
FX (f.fregs[20]), |
|||
FX (f.fregs[21]), |
|||
FX (f.fregs[22]), |
|||
FX (f.fregs[23]), |
|||
FX (f.fregs[24]), |
|||
FX (f.fregs[25]), |
|||
FX (f.fregs[26]), |
|||
FX (f.fregs[27]), |
|||
FX (f.fregs[28]), |
|||
FX (f.fregs[29]), |
|||
FX (f.fregs[30]), |
|||
FX (f.fregs[31]), |
|||
|
|||
X (y), |
|||
X (psr), |
|||
X (wim), |
|||
X (tbr), |
|||
X (pc), |
|||
X (npc), |
|||
FX (fsr), /* fpsr */ |
|||
-1, /* cpsr */ |
|||
}; |
|||
#endif /* SPARC */ |
|||
|
|||
#ifdef rs6000 |
|||
|
|||
static int regmap[] = |
|||
{ |
|||
X (iregs[0]), /* r0 */ |
|||
X (iregs[1]), |
|||
X (iregs[2]), |
|||
X (iregs[3]), |
|||
X (iregs[4]), |
|||
X (iregs[5]), |
|||
X (iregs[6]), |
|||
X (iregs[7]), |
|||
X (iregs[8]), |
|||
X (iregs[9]), |
|||
X (iregs[10]), |
|||
X (iregs[11]), |
|||
X (iregs[12]), |
|||
X (iregs[13]), |
|||
X (iregs[14]), |
|||
X (iregs[15]), |
|||
X (iregs[16]), |
|||
X (iregs[17]), |
|||
X (iregs[18]), |
|||
X (iregs[19]), |
|||
X (iregs[20]), |
|||
X (iregs[21]), |
|||
X (iregs[22]), |
|||
X (iregs[23]), |
|||
X (iregs[24]), |
|||
X (iregs[25]), |
|||
X (iregs[26]), |
|||
X (iregs[27]), |
|||
X (iregs[28]), |
|||
X (iregs[29]), |
|||
X (iregs[30]), |
|||
X (iregs[31]), |
|||
|
|||
X (fregs[0]), /* f0 */ |
|||
X (fregs[1]), |
|||
X (fregs[2]), |
|||
X (fregs[3]), |
|||
X (fregs[4]), |
|||
X (fregs[5]), |
|||
X (fregs[6]), |
|||
X (fregs[7]), |
|||
X (fregs[8]), |
|||
X (fregs[9]), |
|||
X (fregs[10]), |
|||
X (fregs[11]), |
|||
X (fregs[12]), |
|||
X (fregs[13]), |
|||
X (fregs[14]), |
|||
X (fregs[15]), |
|||
X (fregs[16]), |
|||
X (fregs[17]), |
|||
X (fregs[18]), |
|||
X (fregs[19]), |
|||
X (fregs[20]), |
|||
X (fregs[21]), |
|||
X (fregs[22]), |
|||
X (fregs[23]), |
|||
X (fregs[24]), |
|||
X (fregs[25]), |
|||
X (fregs[26]), |
|||
X (fregs[27]), |
|||
X (fregs[28]), |
|||
X (fregs[29]), |
|||
X (fregs[30]), |
|||
X (fregs[31]), |
|||
|
|||
X (srr0), /* IAR (PC) */ |
|||
X (srr1), /* MSR (PS) */ |
|||
X (cr), /* CR */ |
|||
X (lr), /* LR */ |
|||
X (ctr), /* CTR */ |
|||
X (xer), /* XER */ |
|||
X (mq) /* MQ */ |
|||
}; |
|||
|
|||
#endif /* rs6000 */ |
|||
|
|||
#if defined (I386) || defined (M68K) || defined (rs6000) |
|||
|
|||
/* Return the offset relative to the start of the per-thread data to the
|
|||
saved context block. */ |
|||
|
|||
static unsigned long |
|||
registers_addr (int pid) |
|||
{ |
|||
CORE_ADDR stblock; |
|||
int ecpoff = offsetof (st_t, ecp); |
|||
CORE_ADDR ecp; |
|||
|
|||
errno = 0; |
|||
stblock = (CORE_ADDR) ptrace (PTRACE_THREADUSER, pid, (PTRACE_ARG3_TYPE) 0, |
|||
0); |
|||
if (errno) |
|||
perror_with_name ("ptrace(PTRACE_THREADUSER)"); |
|||
|
|||
ecp = (CORE_ADDR) ptrace (PTRACE_PEEKTHREAD, pid, (PTRACE_ARG3_TYPE) ecpoff, |
|||
0); |
|||
if (errno) |
|||
perror_with_name ("ptrace(PTRACE_PEEKTHREAD)"); |
|||
|
|||
return ecp - stblock; |
|||
} |
|||
|
|||
/* Fetch one or more registers from the inferior. REGNO == -1 to get
|
|||
them all. We actually fetch more than requested, when convenient, |
|||
marking them as valid so we won't fetch them again. */ |
|||
|
|||
void |
|||
fetch_inferior_registers (int regno) |
|||
{ |
|||
int reglo, reghi; |
|||
int i; |
|||
unsigned long ecp; |
|||
|
|||
if (regno == -1) |
|||
{ |
|||
reglo = 0; |
|||
reghi = NUM_REGS - 1; |
|||
} |
|||
else |
|||
reglo = reghi = regno; |
|||
|
|||
ecp = registers_addr (PIDGET (inferior_ptid)); |
|||
|
|||
{ |
|||
char buf[MAX_REGISTER_SIZE]; |
|||
for (regno = reglo; regno <= reghi; regno++) |
|||
{ |
|||
int ptrace_fun = PTRACE_PEEKTHREAD; |
|||
|
|||
#ifdef M68K |
|||
ptrace_fun = regno == SP_REGNUM ? PTRACE_PEEKUSP : PTRACE_PEEKTHREAD; |
|||
#endif |
|||
|
|||
for (i = 0; i < register_size (current_gdbarch, regno); i += sizeof (int)) |
|||
{ |
|||
unsigned int reg; |
|||
|
|||
errno = 0; |
|||
reg = ptrace (ptrace_fun, PIDGET (inferior_ptid), |
|||
(PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), 0); |
|||
if (errno) |
|||
perror_with_name ("ptrace(PTRACE_PEEKUSP)"); |
|||
|
|||
*(int *) &buf[i] = reg; |
|||
} |
|||
regcache_raw_supply (current_regcache, regno, buf); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* Store our register values back into the inferior.
|
|||
If REGNO is -1, do this for all registers. |
|||
Otherwise, REGNO specifies which register (so we can save time). */ |
|||
|
|||
void |
|||
store_inferior_registers (int regno) |
|||
{ |
|||
int reglo, reghi; |
|||
int i; |
|||
unsigned long ecp; |
|||
|
|||
if (regno == -1) |
|||
{ |
|||
reglo = 0; |
|||
reghi = NUM_REGS - 1; |
|||
} |
|||
else |
|||
reglo = reghi = regno; |
|||
|
|||
ecp = registers_addr (PIDGET (inferior_ptid)); |
|||
|
|||
for (regno = reglo; regno <= reghi; regno++) |
|||
{ |
|||
int ptrace_fun = PTRACE_POKEUSER; |
|||
|
|||
if (CANNOT_STORE_REGISTER (regno)) |
|||
continue; |
|||
|
|||
#ifdef M68K |
|||
ptrace_fun = regno == SP_REGNUM ? PTRACE_POKEUSP : PTRACE_POKEUSER; |
|||
#endif |
|||
|
|||
for (i = 0; i < register_size (current_gdbarch, regno); i += sizeof (int)) |
|||
{ |
|||
unsigned int reg; |
|||
|
|||
reg = *(unsigned int *) &deprecated_registers[DEPRECATED_REGISTER_BYTE (regno) + i]; |
|||
|
|||
errno = 0; |
|||
ptrace (ptrace_fun, PIDGET (inferior_ptid), |
|||
(PTRACE_ARG3_TYPE) (ecp + regmap[regno] + i), reg); |
|||
if (errno) |
|||
perror_with_name ("ptrace(PTRACE_POKEUSP)"); |
|||
} |
|||
} |
|||
} |
|||
#endif /* defined (I386) || defined (M68K) || defined (rs6000) */ |
|||
|
|||
/* Wait for child to do something. Return pid of child, or -1 in case
|
|||
of error; store status through argument pointer OURSTATUS. */ |
|||
|
|||
ptid_t |
|||
child_wait (ptid_t ptid, struct target_waitstatus *ourstatus) |
|||
{ |
|||
int save_errno; |
|||
int thread; |
|||
union wait status; |
|||
int pid; |
|||
|
|||
while (1) |
|||
{ |
|||
int sig; |
|||
|
|||
set_sigint_trap (); /* Causes SIGINT to be passed on to the
|
|||
attached process. */ |
|||
pid = wait (&status); |
|||
|
|||
save_errno = errno; |
|||
|
|||
clear_sigint_trap (); |
|||
|
|||
if (pid == -1) |
|||
{ |
|||
if (save_errno == EINTR) |
|||
continue; |
|||
fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing: %s.\n", |
|||
safe_strerror (save_errno)); |
|||
/* Claim it exited with unknown signal. */ |
|||
ourstatus->kind = TARGET_WAITKIND_SIGNALLED; |
|||
ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN; |
|||
return -1; |
|||
} |
|||
|
|||
if (pid != PIDGET (inferior_ptid)) /* Some other process?!? */ |
|||
continue; |
|||
|
|||
thread = status.w_tid; /* Get thread id from status */ |
|||
|
|||
/* Initial thread value can only be acquired via wait, so we have to
|
|||
resort to this hack. */ |
|||
|
|||
if (TIDGET (inferior_ptid) == 0 && thread != 0) |
|||
{ |
|||
inferior_ptid = MERGEPID (PIDGET (inferior_ptid), thread); |
|||
add_thread (inferior_ptid); |
|||
} |
|||
|
|||
ptid = BUILDPID (pid, thread); |
|||
|
|||
/* We've become a single threaded process again. */ |
|||
if (thread == 0) |
|||
inferior_ptid = ptid; |
|||
|
|||
/* Check for thread creation. */ |
|||
if (WIFSTOPPED (status) |
|||
&& WSTOPSIG (status) == SIGTRAP |
|||
&& !in_thread_list (ptid)) |
|||
{ |
|||
int realsig; |
|||
|
|||
realsig = ptrace (PTRACE_GETTRACESIG, PIDGET (ptid), |
|||
(PTRACE_ARG3_TYPE) 0, 0); |
|||
|
|||
if (realsig == SIGNEWTHREAD) |
|||
{ |
|||
/* It's a new thread notification. We don't want to much with
|
|||
realsig -- the code in wait_for_inferior expects SIGTRAP. */ |
|||
ourstatus->kind = TARGET_WAITKIND_SPURIOUS; |
|||
ourstatus->value.sig = TARGET_SIGNAL_0; |
|||
return ptid; |
|||
} |
|||
else |
|||
error ("Signal for unknown thread was not SIGNEWTHREAD"); |
|||
} |
|||
|
|||
/* Check for thread termination. */ |
|||
else if (WIFSTOPPED (status) |
|||
&& WSTOPSIG (status) == SIGTRAP |
|||
&& in_thread_list (ptid)) |
|||
{ |
|||
int realsig; |
|||
|
|||
realsig = ptrace (PTRACE_GETTRACESIG, PIDGET (ptid), |
|||
(PTRACE_ARG3_TYPE) 0, 0); |
|||
|
|||
if (realsig == SIGTHREADEXIT) |
|||
{ |
|||
ptrace (PTRACE_CONT, PIDGET (ptid), (PTRACE_ARG3_TYPE) 0, 0); |
|||
continue; |
|||
} |
|||
} |
|||
|
|||
#ifdef SPARC |
|||
/* SPARC Lynx uses an byte reversed wait status; we must use the
|
|||
host macros to access it. These lines just a copy of |
|||
store_waitstatus. We can't use CHILD_SPECIAL_WAITSTATUS |
|||
because target.c can't include the Lynx <sys/wait.h>. */ |
|||
if (WIFEXITED (status)) |
|||
{ |
|||
ourstatus->kind = TARGET_WAITKIND_EXITED; |
|||
ourstatus->value.integer = WEXITSTATUS (status); |
|||
} |
|||
else if (!WIFSTOPPED (status)) |
|||
{ |
|||
ourstatus->kind = TARGET_WAITKIND_SIGNALLED; |
|||
ourstatus->value.sig = |
|||
target_signal_from_host (WTERMSIG (status)); |
|||
} |
|||
else |
|||
{ |
|||
ourstatus->kind = TARGET_WAITKIND_STOPPED; |
|||
ourstatus->value.sig = |
|||
target_signal_from_host (WSTOPSIG (status)); |
|||
} |
|||
#else |
|||
store_waitstatus (ourstatus, status.w_status); |
|||
#endif |
|||
|
|||
return ptid; |
|||
} |
|||
} |
|||
|
|||
/* Return nonzero if the given thread is still alive. */ |
|||
int |
|||
child_thread_alive (ptid_t ptid) |
|||
{ |
|||
int pid = PIDGET (ptid); |
|||
|
|||
/* Arggh. Apparently pthread_kill only works for threads within
|
|||
the process that calls pthread_kill. |
|||
|
|||
We want to avoid the lynx signal extensions as they simply don't |
|||
map well to the generic gdb interface we want to keep. |
|||
|
|||
All we want to do is determine if a particular thread is alive; |
|||
it appears as if we can just make a harmless thread specific |
|||
ptrace call to do that. */ |
|||
return (ptrace (PTRACE_THREADUSER, pid, 0, 0) != -1); |
|||
} |
|||
|
|||
/* Resume execution of the inferior process.
|
|||
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) |
|||
{ |
|||
int func; |
|||
int pid = PIDGET (ptid); |
|||
|
|||
errno = 0; |
|||
|
|||
/* If pid == -1, then we want to step/continue all threads, else
|
|||
we only want to step/continue a single thread. */ |
|||
if (pid == -1) |
|||
{ |
|||
pid = PIDGET (inferior_ptid); |
|||
func = step ? PTRACE_SINGLESTEP : PTRACE_CONT; |
|||
} |
|||
else |
|||
func = step ? PTRACE_SINGLESTEP_ONE : PTRACE_CONT_ONE; |
|||
|
|||
|
|||
/* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
|
|||
it was. (If GDB wanted it to start some other way, we have already |
|||
written a new PC value to the child.) |
|||
|
|||
If this system does not support PT_STEP, a higher level function will |
|||
have called single_step() to transmute the step request into a |
|||
continue request (by setting breakpoints on all possible successor |
|||
instructions), so we don't have to worry about that here. */ |
|||
|
|||
ptrace (func, pid, (PTRACE_ARG3_TYPE) 1, target_signal_to_host (signal)); |
|||
|
|||
if (errno) |
|||
perror_with_name ("ptrace"); |
|||
} |
|||
|
|||
/* Convert a Lynx process ID to a string. Returns the string in a static
|
|||
buffer. */ |
|||
|
|||
char * |
|||
child_pid_to_str (ptid_t ptid) |
|||
{ |
|||
static char buf[40]; |
|||
|
|||
sprintf (buf, "process %d thread %d", PIDGET (ptid), TIDGET (ptid)); |
|||
|
|||
return buf; |
|||
} |
|||
|
|||
/* Extract the register values out of the core file and store
|
|||
them where `read_register' will find them. |
|||
|
|||
CORE_REG_SECT points to the register values themselves, read into memory. |
|||
CORE_REG_SIZE is the size of that area. |
|||
WHICH says which set of registers we are handling (0 = int, 2 = float |
|||
on machines where they are discontiguous). |
|||
REG_ADDR is the offset from u.u_ar0 to the register values relative to |
|||
core_reg_sect. This is used with old-fashioned core files to |
|||
locate the registers in a large upage-plus-stack ".reg" section. |
|||
Original upage address X is at location core_reg_sect+x+reg_addr. |
|||
*/ |
|||
|
|||
static void |
|||
fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which, |
|||
CORE_ADDR reg_addr) |
|||
{ |
|||
struct st_entry s; |
|||
unsigned int regno; |
|||
|
|||
for (regno = 0; regno < NUM_REGS; regno++) |
|||
if (regmap[regno] != -1) |
|||
regcache_raw_supply (current_regcache, regno, |
|||
core_reg_sect + offsetof (st_t, ec) + regmap[regno]); |
|||
|
|||
#ifdef SPARC |
|||
/* Fetching this register causes all of the I & L regs to be read from the
|
|||
stack and validated. */ |
|||
|
|||
fetch_inferior_registers (I0_REGNUM); |
|||
#endif |
|||
} |
|||
|
|||
|
|||
/* Register that we are able to handle lynx core file formats.
|
|||
FIXME: is this really bfd_target_unknown_flavour? */ |
|||
|
|||
static struct core_fns lynx_core_fns = |
|||
{ |
|||
bfd_target_unknown_flavour, /* core_flavour */ |
|||
default_check_format, /* check_format */ |
|||
default_core_sniffer, /* core_sniffer */ |
|||
fetch_core_registers, /* core_read_registers */ |
|||
NULL /* next */ |
|||
}; |
|||
|
|||
void |
|||
_initialize_core_lynx (void) |
|||
{ |
|||
deprecated_add_core_fns (&lynx_core_fns); |
|||
} |
|||
@ -1,800 +0,0 @@ |
|||
/* Remote debugging interface for Tandem ST2000 phone switch, for GDB.
|
|||
|
|||
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, |
|||
2002, 2006, 2007 Free Software Foundation, Inc. |
|||
|
|||
Contributed by Cygnus Support. Written by Jim Kingdon for Cygnus. |
|||
|
|||
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., 51 Franklin Street, Fifth Floor, |
|||
Boston, MA 02110-1301, USA. */ |
|||
|
|||
/* This file was derived from remote-eb.c, which did a similar job, but for
|
|||
an AMD-29K running EBMON. That file was in turn derived from remote.c |
|||
as mentioned in the following comment (left in for comic relief): |
|||
|
|||
"This is like remote.c but is for an esoteric situation-- |
|||
having an a29k board in a PC hooked up to a unix machine with |
|||
a serial line, and running ctty com1 on the PC, through which |
|||
the unix machine can run ebmon. Not to mention that the PC |
|||
has PC/NFS, so it can access the same executables that gdb can, |
|||
over the net in real time." |
|||
|
|||
In reality, this module talks to a debug monitor called 'STDEBUG', which |
|||
runs in a phone switch. We communicate with STDEBUG via either a direct |
|||
serial line, or a TCP (or possibly TELNET) stream to a terminal multiplexor, |
|||
which in turn talks to the phone switch. */ |
|||
|
|||
#include "defs.h" |
|||
#include "gdbcore.h" |
|||
#include "target.h" |
|||
#include "gdb_string.h" |
|||
#include <sys/types.h> |
|||
#include "serial.h" |
|||
#include "regcache.h" |
|||
|
|||
extern struct target_ops st2000_ops; /* Forward declaration */ |
|||
|
|||
static void st2000_close (); |
|||
static void st2000_fetch_register (); |
|||
static void st2000_store_register (); |
|||
|
|||
#define LOG_FILE "st2000.log" |
|||
#if defined (LOG_FILE) |
|||
FILE *log_file; |
|||
#endif |
|||
|
|||
static int timeout = 24; |
|||
|
|||
/* Descriptor for I/O to remote machine. Initialize it to -1 so that
|
|||
st2000_open knows that we don't have a file open when the program |
|||
starts. */ |
|||
|
|||
static struct serial *st2000_desc; |
|||
|
|||
/* Send data to stdebug. Works just like printf. */ |
|||
|
|||
static void |
|||
printf_stdebug (char *pattern,...) |
|||
{ |
|||
va_list args; |
|||
char buf[200]; |
|||
|
|||
va_start (args, pattern); |
|||
|
|||
vsprintf (buf, pattern, args); |
|||
va_end (args); |
|||
|
|||
if (serial_write (st2000_desc, buf, strlen (buf))) |
|||
fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n", |
|||
safe_strerror (errno)); |
|||
} |
|||
|
|||
/* Read a character from the remote system, doing all the fancy timeout
|
|||
stuff. */ |
|||
|
|||
static int |
|||
readchar (int timeout) |
|||
{ |
|||
int c; |
|||
|
|||
c = serial_readchar (st2000_desc, timeout); |
|||
|
|||
#ifdef LOG_FILE |
|||
putc (c & 0x7f, log_file); |
|||
#endif |
|||
|
|||
if (c >= 0) |
|||
return c & 0x7f; |
|||
|
|||
if (c == SERIAL_TIMEOUT) |
|||
{ |
|||
if (timeout == 0) |
|||
return c; /* Polls shouldn't generate timeout errors */ |
|||
|
|||
error (_("Timeout reading from remote system.")); |
|||
} |
|||
|
|||
perror_with_name (_("remote-st2000")); |
|||
} |
|||
|
|||
/* Scan input from the remote system, until STRING is found. If DISCARD is
|
|||
non-zero, then discard non-matching input, else print it out. |
|||
Let the user break out immediately. */ |
|||
static void |
|||
expect (char *string, int discard) |
|||
{ |
|||
char *p = string; |
|||
int c; |
|||
|
|||
immediate_quit++; |
|||
while (1) |
|||
{ |
|||
c = readchar (timeout); |
|||
if (c == *p++) |
|||
{ |
|||
if (*p == '\0') |
|||
{ |
|||
immediate_quit--; |
|||
return; |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if (!discard) |
|||
{ |
|||
fwrite (string, 1, (p - 1) - string, stdout); |
|||
putchar ((char) c); |
|||
fflush (stdout); |
|||
} |
|||
p = string; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* Keep discarding input until we see the STDEBUG prompt.
|
|||
|
|||
The convention for dealing with the prompt is that you |
|||
o give your command |
|||
o *then* wait for the prompt. |
|||
|
|||
Thus the last thing that a procedure does with the serial line |
|||
will be an expect_prompt(). Exception: st2000_resume does not |
|||
wait for the prompt, because the terminal is being handed over |
|||
to the inferior. However, the next thing which happens after that |
|||
is a st2000_wait which does wait for the prompt. |
|||
Note that this includes abnormal exit, e.g. error(). This is |
|||
necessary to prevent getting into states from which we can't |
|||
recover. */ |
|||
static void |
|||
expect_prompt (int discard) |
|||
{ |
|||
#if defined (LOG_FILE) |
|||
/* This is a convenient place to do this. The idea is to do it often
|
|||
enough that we never lose much data if we terminate abnormally. */ |
|||
fflush (log_file); |
|||
#endif |
|||
expect ("dbug> ", discard); |
|||
} |
|||
|
|||
/* Get a hex digit from the remote system & return its value.
|
|||
If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */ |
|||
static int |
|||
get_hex_digit (int ignore_space) |
|||
{ |
|||
int ch; |
|||
while (1) |
|||
{ |
|||
ch = readchar (timeout); |
|||
if (ch >= '0' && ch <= '9') |
|||
return ch - '0'; |
|||
else if (ch >= 'A' && ch <= 'F') |
|||
return ch - 'A' + 10; |
|||
else if (ch >= 'a' && ch <= 'f') |
|||
return ch - 'a' + 10; |
|||
else if (ch == ' ' && ignore_space) |
|||
; |
|||
else |
|||
{ |
|||
expect_prompt (1); |
|||
error (_("Invalid hex digit from remote system.")); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* Get a byte from stdebug and put it in *BYT. Accept any number
|
|||
leading spaces. */ |
|||
static void |
|||
get_hex_byte (char *byt) |
|||
{ |
|||
int val; |
|||
|
|||
val = get_hex_digit (1) << 4; |
|||
val |= get_hex_digit (0); |
|||
*byt = val; |
|||
} |
|||
|
|||
/* Get N 32-bit words from remote, each preceded by a space,
|
|||
and put them in registers starting at REGNO. */ |
|||
static void |
|||
get_hex_regs (int n, int regno) |
|||
{ |
|||
long val; |
|||
int i; |
|||
|
|||
for (i = 0; i < n; i++) |
|||
{ |
|||
int j; |
|||
|
|||
val = 0; |
|||
for (j = 0; j < 8; j++) |
|||
val = (val << 4) + get_hex_digit (j == 0); |
|||
regcache_raw_supply (current_regcache, regno++, (char *) &val); |
|||
} |
|||
} |
|||
|
|||
/* This is called not only when we first attach, but also when the
|
|||
user types "run" after having attached. */ |
|||
static void |
|||
st2000_create_inferior (char *execfile, char *args, char **env, |
|||
int from_tty) |
|||
{ |
|||
int entry_pt; |
|||
|
|||
if (args && *args) |
|||
error (_("Can't pass arguments to remote STDEBUG process")); |
|||
|
|||
if (execfile == 0 || exec_bfd == 0) |
|||
error (_("No executable file specified")); |
|||
|
|||
entry_pt = (int) bfd_get_start_address (exec_bfd); |
|||
|
|||
/* The "process" (board) is already stopped awaiting our commands, and
|
|||
the program is already downloaded. We just set its PC and go. */ |
|||
|
|||
clear_proceed_status (); |
|||
|
|||
/* Tell wait_for_inferior that we've started a new process. */ |
|||
init_wait_for_inferior (); |
|||
|
|||
/* Set up the "saved terminal modes" of the inferior
|
|||
based on what modes we are starting it with. */ |
|||
target_terminal_init (); |
|||
|
|||
/* Install inferior's terminal modes. */ |
|||
target_terminal_inferior (); |
|||
|
|||
/* insert_step_breakpoint (); FIXME, do we need this? */ |
|||
write_pc ((CORE_ADDR) entry_pt); |
|||
} |
|||
|
|||
/* Open a connection to a remote debugger.
|
|||
NAME is the filename used for communication. */ |
|||
|
|||
static int baudrate = 9600; |
|||
static char dev_name[100]; |
|||
|
|||
static void |
|||
st2000_open (char *args, int from_tty) |
|||
{ |
|||
int n; |
|||
char junk[100]; |
|||
|
|||
target_preopen (from_tty); |
|||
|
|||
n = sscanf (args, " %s %d %s", dev_name, &baudrate, junk); |
|||
|
|||
if (n != 2) |
|||
error (_("Bad arguments. Usage: target st2000 <device> <speed>\n\
|
|||
or target st2000 <host> <port>\n")); |
|||
|
|||
st2000_close (0); |
|||
|
|||
st2000_desc = serial_open (dev_name); |
|||
|
|||
if (!st2000_desc) |
|||
perror_with_name (dev_name); |
|||
|
|||
if (serial_setbaudrate (st2000_desc, baudrate)) |
|||
{ |
|||
serial_close (dev_name); |
|||
perror_with_name (dev_name); |
|||
} |
|||
|
|||
serial_raw (st2000_desc); |
|||
|
|||
push_target (&st2000_ops); |
|||
|
|||
#if defined (LOG_FILE) |
|||
log_file = fopen (LOG_FILE, "w"); |
|||
if (log_file == NULL) |
|||
perror_with_name ((LOG_FILE)); |
|||
#endif |
|||
|
|||
/* Hello? Are you there? */ |
|||
printf_stdebug ("\003"); /* ^C wakes up dbug */ |
|||
|
|||
expect_prompt (1); |
|||
|
|||
if (from_tty) |
|||
printf ("Remote %s connected to %s\n", target_shortname, |
|||
dev_name); |
|||
} |
|||
|
|||
/* Close out all files and local state before this target loses control. */ |
|||
|
|||
static void |
|||
st2000_close (int quitting) |
|||
{ |
|||
serial_close (st2000_desc); |
|||
|
|||
#if defined (LOG_FILE) |
|||
if (log_file) |
|||
{ |
|||
if (ferror (log_file)) |
|||
fprintf_unfiltered (gdb_stderr, "Error writing log file.\n"); |
|||
if (fclose (log_file) != 0) |
|||
fprintf_unfiltered (gdb_stderr, "Error closing log file.\n"); |
|||
} |
|||
#endif |
|||
} |
|||
|
|||
/* Terminate the open connection to the remote debugger.
|
|||
Use this when you want to detach and do something else |
|||
with your gdb. */ |
|||
static void |
|||
st2000_detach (int from_tty) |
|||
{ |
|||
pop_target (); /* calls st2000_close to do the real work */ |
|||
if (from_tty) |
|||
printf ("Ending remote %s debugging\n", target_shortname); |
|||
} |
|||
|
|||
/* Tell the remote machine to resume. */ |
|||
|
|||
static void |
|||
st2000_resume (ptid_t ptid, int step, enum target_signal sig) |
|||
{ |
|||
if (step) |
|||
{ |
|||
printf_stdebug ("ST\r"); |
|||
/* Wait for the echo. */ |
|||
expect ("ST\r", 1); |
|||
} |
|||
else |
|||
{ |
|||
printf_stdebug ("GO\r"); |
|||
/* Swallow the echo. */ |
|||
expect ("GO\r", 1); |
|||
} |
|||
} |
|||
|
|||
/* Wait until the remote machine stops, then return,
|
|||
storing status in STATUS just as `wait' would. */ |
|||
|
|||
static ptid_t |
|||
st2000_wait (ptid_t ptid, struct target_waitstatus *status) |
|||
{ |
|||
int old_timeout = timeout; |
|||
|
|||
status->kind = TARGET_WAITKIND_EXITED; |
|||
status->value.integer = 0; |
|||
|
|||
timeout = 0; /* Don't time out -- user program is running. */ |
|||
|
|||
expect_prompt (0); /* Wait for prompt, outputting extraneous text */ |
|||
|
|||
status->kind = TARGET_WAITKIND_STOPPED; |
|||
status->value.sig = TARGET_SIGNAL_TRAP; |
|||
|
|||
timeout = old_timeout; |
|||
|
|||
return inferior_ptid; |
|||
} |
|||
|
|||
/* Return the name of register number REGNO in the form input and
|
|||
output by STDEBUG. Currently, REGISTER_NAME just happens return |
|||
exactly what STDEBUG wants. Lets take advantage of that just as |
|||
long as possible! */ |
|||
|
|||
static char * |
|||
get_reg_name (int regno) |
|||
{ |
|||
static char buf[50]; |
|||
const char *p; |
|||
char *b; |
|||
|
|||
b = buf; |
|||
|
|||
for (p = REGISTER_NAME (regno); *p; p++) |
|||
*b++ = toupper (*p); |
|||
*b = '\000'; |
|||
|
|||
return buf; |
|||
} |
|||
|
|||
/* Read the remote registers into the block REGS. */ |
|||
|
|||
static void |
|||
st2000_fetch_registers (void) |
|||
{ |
|||
int regno; |
|||
|
|||
/* Yeah yeah, I know this is horribly inefficient. But it isn't done
|
|||
very often... I'll clean it up later. */ |
|||
|
|||
for (regno = 0; regno <= PC_REGNUM; regno++) |
|||
st2000_fetch_register (regno); |
|||
} |
|||
|
|||
/* Fetch register REGNO, or all registers if REGNO is -1.
|
|||
Returns errno value. */ |
|||
static void |
|||
st2000_fetch_register (int regno) |
|||
{ |
|||
if (regno == -1) |
|||
st2000_fetch_registers (); |
|||
else |
|||
{ |
|||
char *name = get_reg_name (regno); |
|||
printf_stdebug ("DR %s\r", name); |
|||
expect (name, 1); |
|||
expect (" : ", 1); |
|||
get_hex_regs (1, regno); |
|||
expect_prompt (1); |
|||
} |
|||
return; |
|||
} |
|||
|
|||
/* Store the remote registers from the contents of the block REGS. */ |
|||
|
|||
static void |
|||
st2000_store_registers (void) |
|||
{ |
|||
int regno; |
|||
|
|||
for (regno = 0; regno <= PC_REGNUM; regno++) |
|||
st2000_store_register (regno); |
|||
|
|||
registers_changed (); |
|||
} |
|||
|
|||
/* Store register REGNO, or all if REGNO == 0.
|
|||
Return errno value. */ |
|||
static void |
|||
st2000_store_register (int regno) |
|||
{ |
|||
if (regno == -1) |
|||
st2000_store_registers (); |
|||
else |
|||
{ |
|||
printf_stdebug ("PR %s %x\r", get_reg_name (regno), |
|||
read_register (regno)); |
|||
|
|||
expect_prompt (1); |
|||
} |
|||
} |
|||
|
|||
/* Get ready to modify the registers array. On machines which store
|
|||
individual registers, this doesn't need to do anything. On machines |
|||
which store all the registers in one fell swoop, this makes sure |
|||
that registers contains all the registers from the program being |
|||
debugged. */ |
|||
|
|||
static void |
|||
st2000_prepare_to_store (void) |
|||
{ |
|||
/* Do nothing, since we can store individual regs */ |
|||
} |
|||
|
|||
static void |
|||
st2000_files_info (void) |
|||
{ |
|||
printf ("\tAttached to %s at %d baud.\n", |
|||
dev_name, baudrate); |
|||
} |
|||
|
|||
/* Copy LEN bytes of data from debugger memory at MYADDR
|
|||
to inferior's memory at MEMADDR. Returns length moved. */ |
|||
static int |
|||
st2000_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) |
|||
{ |
|||
int i; |
|||
|
|||
for (i = 0; i < len; i++) |
|||
{ |
|||
printf_stdebug ("PM.B %x %x\r", memaddr + i, myaddr[i]); |
|||
expect_prompt (1); |
|||
} |
|||
return len; |
|||
} |
|||
|
|||
/* Read LEN bytes from inferior memory at MEMADDR. Put the result
|
|||
at debugger address MYADDR. Returns length moved. */ |
|||
static int |
|||
st2000_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) |
|||
{ |
|||
int i; |
|||
|
|||
/* Number of bytes read so far. */ |
|||
int count; |
|||
|
|||
/* Starting address of this pass. */ |
|||
unsigned long startaddr; |
|||
|
|||
/* Number of bytes to read in this pass. */ |
|||
int len_this_pass; |
|||
|
|||
/* Note that this code works correctly if startaddr is just less
|
|||
than UINT_MAX (well, really CORE_ADDR_MAX if there was such a |
|||
thing). That is, something like |
|||
st2000_read_bytes (CORE_ADDR_MAX - 4, foo, 4) |
|||
works--it never adds len to memaddr and gets 0. */ |
|||
/* However, something like
|
|||
st2000_read_bytes (CORE_ADDR_MAX - 3, foo, 4) |
|||
doesn't need to work. Detect it and give up if there's an attempt |
|||
to do that. */ |
|||
if (((memaddr - 1) + len) < memaddr) |
|||
{ |
|||
errno = EIO; |
|||
return 0; |
|||
} |
|||
|
|||
startaddr = memaddr; |
|||
count = 0; |
|||
while (count < len) |
|||
{ |
|||
len_this_pass = 16; |
|||
if ((startaddr % 16) != 0) |
|||
len_this_pass -= startaddr % 16; |
|||
if (len_this_pass > (len - count)) |
|||
len_this_pass = (len - count); |
|||
|
|||
printf_stdebug ("DI.L %x %x\r", startaddr, len_this_pass); |
|||
expect (": ", 1); |
|||
|
|||
for (i = 0; i < len_this_pass; i++) |
|||
get_hex_byte (&myaddr[count++]); |
|||
|
|||
expect_prompt (1); |
|||
|
|||
startaddr += len_this_pass; |
|||
} |
|||
return len; |
|||
} |
|||
|
|||
/* Transfer LEN bytes between GDB address MYADDR and target address
|
|||
MEMADDR. If WRITE is non-zero, transfer them to the target, |
|||
otherwise transfer them from the target. TARGET is unused. |
|||
|
|||
Returns the number of bytes transferred. */ |
|||
|
|||
static int |
|||
st2000_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, |
|||
int write, struct mem_attrib *attrib, |
|||
struct target_ops *target) |
|||
{ |
|||
if (write) |
|||
return st2000_write_inferior_memory (memaddr, myaddr, len); |
|||
else |
|||
return st2000_read_inferior_memory (memaddr, myaddr, len); |
|||
} |
|||
|
|||
static void |
|||
st2000_kill (char *args, int from_tty) |
|||
{ |
|||
return; /* Ignore attempts to kill target system */ |
|||
} |
|||
|
|||
/* Clean up when a program exits.
|
|||
|
|||
The program actually lives on in the remote processor's RAM, and may be |
|||
run again without a download. Don't leave it full of breakpoint |
|||
instructions. */ |
|||
|
|||
static void |
|||
st2000_mourn_inferior (void) |
|||
{ |
|||
remove_breakpoints (); |
|||
unpush_target (&st2000_ops); |
|||
generic_mourn_inferior (); /* Do all the proper things now */ |
|||
} |
|||
|
|||
#define MAX_STDEBUG_BREAKPOINTS 16 |
|||
|
|||
static CORE_ADDR breakaddr[MAX_STDEBUG_BREAKPOINTS] = |
|||
{0}; |
|||
|
|||
static int |
|||
st2000_insert_breakpoint (struct bp_target_info *bp_tgt) |
|||
{ |
|||
CORE_ADDR addr = bp_tgt->placed_address; |
|||
int i; |
|||
|
|||
for (i = 0; i <= MAX_STDEBUG_BREAKPOINTS; i++) |
|||
if (breakaddr[i] == 0) |
|||
{ |
|||
breakaddr[i] = addr; |
|||
|
|||
printf_stdebug ("BR %x H\r", addr); |
|||
expect_prompt (1); |
|||
return 0; |
|||
} |
|||
|
|||
fprintf_unfiltered (gdb_stderr, "Too many breakpoints (> 16) for STDBUG\n"); |
|||
return 1; |
|||
} |
|||
|
|||
static int |
|||
st2000_remove_breakpoint (struct bp_target_info *bp_tgt) |
|||
{ |
|||
CORE_ADDR addr = bp_tgt->placed_address; |
|||
int i; |
|||
|
|||
for (i = 0; i < MAX_STDEBUG_BREAKPOINTS; i++) |
|||
if (breakaddr[i] == addr) |
|||
{ |
|||
breakaddr[i] = 0; |
|||
|
|||
printf_stdebug ("CB %d\r", i); |
|||
expect_prompt (1); |
|||
return 0; |
|||
} |
|||
|
|||
fprintf_unfiltered (gdb_stderr, |
|||
"Can't find breakpoint associated with 0x%x\n", addr); |
|||
return 1; |
|||
} |
|||
|
|||
|
|||
/* Put a command string, in args, out to STDBUG. Output from STDBUG is placed
|
|||
on the users terminal until the prompt is seen. */ |
|||
|
|||
static void |
|||
st2000_command (char *args, int fromtty) |
|||
{ |
|||
if (!st2000_desc) |
|||
error (_("st2000 target not open.")); |
|||
|
|||
if (!args) |
|||
error (_("Missing command.")); |
|||
|
|||
printf_stdebug ("%s\r", args); |
|||
expect_prompt (0); |
|||
} |
|||
|
|||
/* Connect the user directly to STDBUG. This command acts just like the
|
|||
'cu' or 'tip' command. Use <CR>~. or <CR>~^D to break out. */ |
|||
|
|||
/*static struct ttystate ttystate; */ |
|||
|
|||
static void |
|||
cleanup_tty (void) |
|||
{ |
|||
printf ("\r\n[Exiting connect mode]\r\n"); |
|||
/* serial_restore(0, &ttystate); */ |
|||
} |
|||
|
|||
#if 0 |
|||
/* This all should now be in serial.c */ |
|||
|
|||
static void |
|||
connect_command (char *args, int fromtty) |
|||
{ |
|||
fd_set readfds; |
|||
int numfds; |
|||
int c; |
|||
char cur_esc = 0; |
|||
|
|||
dont_repeat (); |
|||
|
|||
if (st2000_desc < 0) |
|||
error (_("st2000 target not open.")); |
|||
|
|||
if (args) |
|||
fprintf ("This command takes no args. They have been ignored.\n"); |
|||
|
|||
printf ("[Entering connect mode. Use ~. or ~^D to escape]\n"); |
|||
|
|||
serial_raw (0, &ttystate); |
|||
|
|||
make_cleanup (cleanup_tty, 0); |
|||
|
|||
FD_ZERO (&readfds); |
|||
|
|||
while (1) |
|||
{ |
|||
do |
|||
{ |
|||
FD_SET (0, &readfds); |
|||
FD_SET (deprecated_serial_fd (st2000_desc), &readfds); |
|||
numfds = gdb_select (sizeof (readfds) * 8, &readfds, 0, 0, 0); |
|||
} |
|||
while (numfds == 0); |
|||
|
|||
if (numfds < 0) |
|||
perror_with_name (("select")); |
|||
|
|||
if (FD_ISSET (0, &readfds)) |
|||
{ /* tty input, send to stdebug */ |
|||
c = getchar (); |
|||
if (c < 0) |
|||
perror_with_name (("connect")); |
|||
|
|||
printf_stdebug ("%c", c); |
|||
switch (cur_esc) |
|||
{ |
|||
case 0: |
|||
if (c == '\r') |
|||
cur_esc = c; |
|||
break; |
|||
case '\r': |
|||
if (c == '~') |
|||
cur_esc = c; |
|||
else |
|||
cur_esc = 0; |
|||
break; |
|||
case '~': |
|||
if (c == '.' || c == '\004') |
|||
return; |
|||
else |
|||
cur_esc = 0; |
|||
} |
|||
} |
|||
|
|||
if (FD_ISSET (deprecated_serial_fd (st2000_desc), &readfds)) |
|||
{ |
|||
while (1) |
|||
{ |
|||
c = readchar (0); |
|||
if (c < 0) |
|||
break; |
|||
putchar (c); |
|||
} |
|||
fflush (stdout); |
|||
} |
|||
} |
|||
} |
|||
#endif /* 0 */ |
|||
|
|||
/* Define the target subroutine names */ |
|||
|
|||
struct target_ops st2000_ops; |
|||
|
|||
static void |
|||
init_st2000_ops (void) |
|||
{ |
|||
st2000_ops.to_shortname = "st2000"; |
|||
st2000_ops.to_longname = "Remote serial Tandem ST2000 target"; |
|||
st2000_ops.to_doc = "Use a remote computer running STDEBUG connected by a serial line;\n\
|
|||
or a network connection.\n\ |
|||
Arguments are the name of the device for the serial line,\n\ |
|||
the speed to connect at in bits per second."; |
|||
st2000_ops.to_open = st2000_open; |
|||
st2000_ops.to_close = st2000_close; |
|||
st2000_ops.to_detach = st2000_detach; |
|||
st2000_ops.to_resume = st2000_resume; |
|||
st2000_ops.to_wait = st2000_wait; |
|||
st2000_ops.to_fetch_registers = st2000_fetch_register; |
|||
st2000_ops.to_store_registers = st2000_store_register; |
|||
st2000_ops.to_prepare_to_store = st2000_prepare_to_store; |
|||
st2000_ops.deprecated_xfer_memory = st2000_xfer_inferior_memory; |
|||
st2000_ops.to_files_info = st2000_files_info; |
|||
st2000_ops.to_insert_breakpoint = st2000_insert_breakpoint; |
|||
st2000_ops.to_remove_breakpoint = st2000_remove_breakpoint; /* Breakpoints */ |
|||
st2000_ops.to_kill = st2000_kill; |
|||
st2000_ops.to_create_inferior = st2000_create_inferior; |
|||
st2000_ops.to_mourn_inferior = st2000_mourn_inferior; |
|||
st2000_ops.to_stratum = process_stratum; |
|||
st2000_ops.to_has_all_memory = 1; |
|||
st2000_ops.to_has_memory = 1; |
|||
st2000_ops.to_has_stack = 1; |
|||
st2000_ops.to_has_registers = 1; |
|||
st2000_ops.to_has_execution = 1; /* all mem, mem, stack, regs, exec */ |
|||
st2000_ops.to_magic = OPS_MAGIC; /* Always the last thing */ |
|||
}; |
|||
|
|||
void |
|||
_initialize_remote_st2000 (void) |
|||
{ |
|||
init_st2000_ops (); |
|||
add_target (&st2000_ops); |
|||
add_com ("st2000", class_obscure, st2000_command, |
|||
_("Send a command to the STDBUG monitor.")); |
|||
add_com ("connect", class_obscure, connect_command, _("\
|
|||
Connect the terminal directly up to the STDBUG command monitor.\n\ |
|||
Use <CR>~. or <CR>~^D to break out.")); |
|||
} |
|||
File diff suppressed because it is too large
Loading…
Reference in new issue