(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.
+2007-03-29 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * Makefile.in (coff_solib_h, coff-solib.o, i386v-nat.o, lynx-nat.o)
+ (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.
+
2007-03-29 Daniel Jacobowitz <dan@codesourcery.com>
* defs.h (deprecated_registers_changed_hook): Delete declaration.
c_lang_h = c-lang.h $(value_h) $(macroexp_h)
cli_out_h = cli-out.h
coff_pe_read_h = coff-pe-read.h
-coff_solib_h = coff-solib.h
command_h = command.h
complaints_h = complaints.h
completer_h = completer.h
# wrong if TAGS has files twice). Because this is tricky to get
# right, it is probably easiest just to list .h files here directly.
-HFILES_NO_SRCDIR = bcache.h buildsym.h call-cmds.h coff-solib.h defs.h \
+HFILES_NO_SRCDIR = bcache.h buildsym.h call-cmds.h defs.h \
exceptions.h \
environ.h $(gdbcmd_h) gdb.h gdbcore.h \
gdb-stabs.h $(inferior_h) language.h monitor.h \
armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c \
avr-tdep.c \
bsd-uthread.c bsd-kvm.c \
- coff-solib.c \
core-regset.c core-aout.c corelow.c \
dcache.c exec.c \
fbsd-nat.c \
hppa-linux-tdep.c hppa-linux-nat.c \
hppabsd-nat.c hppabsd-tdep.c \
hpread.c \
- i386-tdep.c i386v-nat.c i386-linux-nat.c \
+ i386-tdep.c i386-linux-nat.c \
i386v4-nat.c i386-cygwin-tdep.c \
i386bsd-nat.c i386bsd-tdep.c i386fbsd-nat.c i386fbsd-tdep.c \
i386nbsd-nat.c i386nbsd-tdep.c i386obsd-nat.c i386obsd-tdep.c \
infptrace.c inftarg.c irix5-nat.c \
libunwind-frame.c \
linux-fork.c \
- lynx-nat.c \
m68hc11-tdep.c \
m32r-tdep.c \
m32r-linux-nat.c m32r-linux-tdep.c \
remote-e7000.c \
remote-hms.c remote-m32r-sdi.c remote-mips.c \
remote-sim.c \
- remote-st.c remote-utils.c dcache.c \
+ remote-utils.c dcache.c \
rs6000-nat.c rs6000-tdep.c \
s390-tdep.c s390-nat.c \
score-tdep.c \
$(coff_internal_h) $(libcoff_h) $(objfiles_h) $(buildsym_h) \
$(gdb_stabs_h) $(stabsread_h) $(complaints_h) $(target_h) \
$(gdb_assert_h) $(block_h) $(dictionary_h) $(coff_pe_read_h)
-coff-solib.o: coff-solib.c $(defs_h) $(frame_h) $(bfd_h) $(gdbcore_h) \
- $(symtab_h) $(symfile_h) $(objfiles_h)
complaints.o: complaints.c $(defs_h) $(complaints_h) $(gdb_assert_h) \
$(command_h) $(gdbcmd_h)
completer.o: completer.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(i386_tdep_h) $(i387_tdep_h)
i386v4-nat.o: i386v4-nat.c $(defs_h) $(value_h) $(inferior_h) $(regcache_h) \
$(i386_tdep_h) $(i387_tdep_h) $(gregset_h)
-i386v-nat.o: i386v-nat.c $(defs_h) $(frame_h) $(inferior_h) $(language_h) \
- $(gdbcore_h) $(gdb_stat_h) $(floatformat_h) $(target_h) \
- $(i386_tdep_h)
i387-tdep.o: i387-tdep.c $(defs_h) $(doublest_h) $(floatformat_h) $(frame_h) \
$(gdbcore_h) $(inferior_h) $(language_h) $(regcache_h) $(value_h) \
$(gdb_assert_h) $(gdb_string_h) $(i386_tdep_h) $(i387_tdep_h)
$(gdb_proc_service_h) $(gdb_thread_db_h) $(bfd_h) $(exceptions_h) \
$(gdbthread_h) $(inferior_h) $(symfile_h) $(objfiles_h) $(target_h) \
$(regcache_h) $(solib_svr4_h) $(gdbcore_h) $(linux_nat_h)
-lynx-nat.o: lynx-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
- $(gdbcore_h) $(regcache_h)
m2-exp.o: m2-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(language_h) \
$(value_h) $(parser_defs_h) $(m2_lang_h) $(bfd_h) $(symfile_h) \
$(objfiles_h) $(block_h)
$(gdb_callback_h) $(gdb_remote_sim_h) $(remote_utils_h) $(command_h) \
$(regcache_h) $(gdb_assert_h) $(sim_regno_h) $(arch_utils_h) \
$(readline_h)
-remote-st.o: remote-st.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \
- $(serial_h) $(regcache_h)
remote-utils.o: remote-utils.c $(defs_h) $(gdb_string_h) $(gdbcmd_h) \
$(target_h) $(serial_h) $(gdbcore_h) $(inferior_h) $(remote_utils_h) \
$(regcache_h)
$(target_h) $(demangle_h) $(expression_h) $(language_h) $(charset_h) \
$(annotate_h) $(filenames_h) $(symfile_h) $(inferior_h) $(top_h) \
$(gdb_curses_h) $(readline_h) $(gdb_obstack_h)
-uw-thread.o: uw-thread.c $(defs_h) $(gdbthread_h) $(target_h) $(inferior_h) \
- $(regcache_h) $(gregset_h)
v850-tdep.o: v850-tdep.c $(defs_h) $(frame_h) $(frame_base_h) $(trad_frame_h) \
$(frame_unwind_h) $(dwarf2_frame_h) $(gdbtypes_h) $(inferior_h) \
$(gdb_string_h) $(gdb_assert_h) $(gdbcore_h) $(arch_utils_h) \
Read an XML target description from the target, which describes its
features.
+* Removed targets
+
+Support for these obsolete configurations has been removed.
+
+hppa*-*-hiux*
+i[34567]86-ncr-*
+i[34567]86-*-dgux*
+i[34567]86-*-lynxos*
+i[34567]86-*-netware*
+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*
+m68*-cisco*-*
+m68*-tandem-*
+rs6000-*-lynxos*
+
*** Changes in GDB 6.6
* New targets
+++ /dev/null
-/* 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);
-}
+++ /dev/null
-/* 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
+++ /dev/null
-# 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
+++ /dev/null
-# 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
+++ /dev/null
-# 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
-
+++ /dev/null
-# 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
+++ /dev/null
-# 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
+++ /dev/null
-# 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
-
+++ /dev/null
-# 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
+++ /dev/null
-# Target: Intel 386 running SVR4
-TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o solib-legacy.o
+++ /dev/null
-/* 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 */
+++ /dev/null
-/* 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
+++ /dev/null
-/* 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 */
+++ /dev/null
-/* 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 */
+++ /dev/null
-/* 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
+++ /dev/null
-/* 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 */
+++ /dev/null
-# Target: Cisco Router with 68K processor
-TDEPFILES= m68k-tdep.o corelow.o core-aout.o
-DEPRECATED_TM_FILE= tm-cisco.h
+++ /dev/null
-# Target: os68k running on a 68000
-TDEPFILES= m68k-tdep.o
-DEPRECATED_TM_FILE= tm-os68k.h
+++ /dev/null
-# Target: Tandem ST-2000 phone switch
-TDEPFILES= m68k-tdep.o remote-st.o
+++ /dev/null
-/* 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
+++ /dev/null
-/* 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)
+++ /dev/null
-/* 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 */
+++ /dev/null
-# 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
+++ /dev/null
-# 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
+++ /dev/null
-/* 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 */
# Map host cpu into the config cpu subdirectory name.
# The default is $host_cpu.
+case $host in
+ 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* | \
+ rs6000-*-lynxos* | \
+ null)
+ echo "*** Configuration $host is obsolete." >&2
+ echo "*** Support has been REMOVED." >&2
+ exit 1
+ ;;
+esac
+
case "${host_cpu}" in
alpha*) gdb_host_cpu=alpha ;;
arm*-*-netbsd*) gdb_host=nbsdaout ;;
arm*-*-openbsd*) gdb_host=nbsdelf ;;
-hppa*-*-hpux* | hppa*-*-hiux*)
+hppa*-*-hpux*)
gdb_host=hpux ;;
hppa*-*-linux*) gdb_host=linux ;;
hppa*-*-openbsd*) gdb_host=obsd ;;
-i[34567]86-ncr-*) gdb_host=ncr3000 ;;
-i[34567]86-*-dgux*) gdb_host=i386v4 ;;
i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)
gdb_host=fbsd ;;
i[34567]86-*-netbsdelf* | i[34567]86-*-knetbsd*-gnu)
;;
i[34567]86-*-msdosdjgpp*) gdb_host=go32 ;;
i[34567]86-*-linux*) gdb_host=linux ;;
-i[34567]86-*-lynxos*) gdb_host=i386lynx ;;
i[34567]86-*-gnu*) gdb_host=i386gnu ;;
i[3456]86-*-nto*) gdb_host=nto ;;
i[34567]86-*-openbsd[0-2].* | i[34567]86-*-openbsd3.[0-3])
gdb_host=obsdaout ;;
i[34567]86-*-openbsd*) gdb_host=obsd ;;
-i[34567]86-*-sco3.2v5*) gdb_host=i386sco5 ;;
-i[34567]86-*-sco3.2v4*) gdb_host=i386sco4 ;;
-i[34567]86-*-sco*) gdb_host=i386sco ;;
i[34567]86-*-solaris2.1[0-9]*) gdb_host=sol2-64 ;;
i[34567]86-*-solaris*) gdb_host=i386sol2 ;;
-i[34567]86-*-sysv4.2*) gdb_host=i386v42mp ;;
-i[34567]86-*-sysv4*) gdb_host=i386v4 ;;
-i[34567]86-*-sysv5*) gdb_host=i386v42mp ;;
-i[34567]86-*-unixware2*) gdb_host=i386v42mp ;;
-i[34567]86-*-unixware*) gdb_host=i386v4 ;;
-i[34567]86-*-sysv*) gdb_host=i386v ;;
-i[34567]86-*-isc*) gdb_host=i386v ;;
i[34567]86-*-cygwin*) gdb_host=cygwin ;;
ia64-*-linux*) gdb_host=linux ;;
fi
;;
-rs6000-*-lynxos*) gdb_host=rs6000lynx ;;
rs6000-*-aix4*) gdb_host=aix4 ;;
rs6000-*-*) gdb_host=rs6000 ;;
# gdb_target_cpu generic name of CPU
# gdb_target name of GDB target definition to use
+case $target in
+ hppa*-*-hiux* | \
+ i[34567]86-ncr-* | \
+ i[34567]86-*-lynxos* | \
+ m68*-cisco*-* | \
+ m68*-tandem-* | \
+ m68*-*-os68k* | \
+ rs6000-*-lynxos* | \
+ null)
+ echo "*** Configuration $target is obsolete." >&2
+ echo "*** Support has been REMOVED." >&2
+ exit 1
+ ;;
+esac
+
# Map target cpu into the config cpu subdirectory name.
# The default is $target_cpu.
hppa*64*-*-hpux11*) gdb_target=hppa64 ;;
hppa*-*-hpux*) gdb_target=hppahpux ;;
-hppa*-*-hiux*) gdb_target=hppahpux ;;
hppa*-*-linux*) gdb_target=linux ;;
hppa*-*-openbsd*) gdb_target=obsd ;;
hppa*-*-*) gdb_target=hppa ;;
-i[34567]86-ncr-*) gdb_target=ncr3000 ;;
i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu)
gdb_target=nbsd ;;
i[34567]86-*-openbsd*) gdb_target=obsd ;;
i[34567]86-*-nto*) gdb_target=nto ;;
-i[34567]86-*-lynxos*) gdb_target=i386lynx ;;
i[34567]86-*-solaris2.1[0-9]*) gdb_target=sol2-64 ;;
i[34567]86-*-solaris*) gdb_target=i386sol2 ;;
i[34567]86-*-linux*) gdb_target=linux
build_gdbserver=yes
;;
i[34567]86-*-gnu*) gdb_target=i386gnu ;;
-i[34567]86-*-netware*) gdb_target=i386 ;;
i[34567]86-*-cygwin*) gdb_target=cygwin
build_gdbserver=yes
;;
m68hc11*-*-*|m6811*-*-*) gdb_target=m68hc11 ;;
-m68*-cisco*-*) gdb_target=cisco ;;
-m68*-tandem-*) gdb_target=st2000 ;;
m68*-*-aout*) gdb_target=monitor ;;
m68*-*-coff*) gdb_target=monitor ;;
m68*-*-elf*) gdb_target=monitor ;;
m68*-*-netbsd* | m68*-*-knetbsd*-gnu)
gdb_target=nbsd ;;
m68*-*-openbsd*) gdb_target=obsd ;;
-m68*-*-os68k*) gdb_target=os68k ;;
m68*-*-uclinux*) gdb_target=monitor ;;
m88*-*-openbsd*) gdb_target=obsd ;;
gdb_target=ppc-eabi
fi ;;
-rs6000-*-lynxos*) gdb_target=rs6000lynx ;;
rs6000-*-aix4*) gdb_target=aix4 ;;
rs6000-*-*) gdb_target=rs6000 ;;
+++ /dev/null
-/* 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"
-\f
-
-/* 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));
-}
-\f
-#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 */
+++ /dev/null
-/* 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
-}
-\f
-
-/* 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);
-}
+++ /dev/null
-/* 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."));
-}
+++ /dev/null
-/* Low level interface for debugging UnixWare user-mode threads for
- GDB, the GNU debugger.
-
- Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
- Written by Nick Duffek <nsd@cygnus.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., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
-
-
-/* Like many systems, UnixWare implements two classes of threads:
- kernel-mode threads, which are scheduled by the kernel; and
- user-mode threads, which are scheduled by a library. UnixWare
- calls these two classes lightweight processes (LWPs) and threads,
- respectively.
-
- This module deals with user-mode threads. It calls procfs_ops
- functions to deal with LWPs and processes and core_ops functions to
- deal with core files.
-
- As of this writing, the user-mode thread debugging interface is not
- documented beyond the comments in <thread.h>. The following
- description has been gleaned from experience and from information
- provided by SCO.
-
- libthread.so, against which all UnixWare user-mode thread programs
- link, provides a global thread_debug structure named _thr_debug.
- It has three fields:
-
- (1) thr_map is a pointer to a pointer to an element of a
- thread_map ring. A thread_map contains a single thread's id
- number, state, LWP pointer, recent register state, and other
- useful information.
-
- (2) thr_brk is a pointer to a stub function that libthread.so
- calls when it changes a thread's state, e.g. by creating it,
- switching it to an LWP, or causing it to exit.
-
- (3) thr_debug_on controls whether libthread.so calls thr_brk().
-
- Debuggers are able to track thread activity by setting a private
- breakpoint on thr_brk() and setting thr_debug_on to 1.
-
- thr_brk() receives two arguments:
-
- (1) a pointer to a thread_map describing the thread being
- changed; and
-
- (2) an enum thread_change specifying one of the following
- changes:
-
- invalid unknown
- thread_create thread has just been created
- thread_exit thread has just exited
- switch_begin thread will be switched to an LWP
- switch_complete thread has been switched to an LWP
- cancel_complete thread wasn't switched to an LWP
- thread_suspend thread has been thr_suspend()ed
- thread_suspend_pending thread will be thr_suspend()ed
- thread_continue thread has been thr_continue()d
-
- The thread_map argument to thr_brk() is NULL under the following
- circumstances:
-
- - The main thread is being acted upon. The main thread always
- has id 1, so its thread_map is easy to find by scanning through
- _thr_debug.thr_map.
-
- - A "switch_complete" change is occurring, which means that the
- thread specified in the most recent "switch_begin" change has
- moved to an LWP.
-
- - A "cancel_complete" change is occurring, which means that the
- thread specified in the most recent "switch_begin" change has
- not moved to an LWP after all.
-
- - A spurious "switch_begin" change is occurring after a
- "thread_exit" change.
-
- Between switch_begin and switch_complete or cancel_complete, the
- affected thread's LWP pointer is not reliable. It is possible that
- other parts of the thread's thread_map are also unreliable during
- that time. */
-
-
-#include "defs.h"
-#include "gdbthread.h"
-#include "target.h"
-#include "inferior.h"
-#include "regcache.h"
-#include <fcntl.h>
-
-/* <thread.h> includes <sys/priocntl.h>, which requires boolean_t from
- <sys/types.h>, which doesn't typedef boolean_t with gcc. */
-
-#define boolean_t int
-#include <thread.h>
-#undef boolean_t
-
-#include <synch.h> /* for UnixWare 2.x */
-
-/* Prototypes for supply_gregset etc. */
-#include "gregset.h"
-
-/* Offset from SP to first arg on stack at first instruction of a
- function. We provide a default here that's right for most, if not
- all, targets that use this file. */
-
-#ifndef SP_ARG0
-#define SP_ARG0 (1 * 4)
-#endif
-
-/* Whether to emit debugging output. */
-
-#define DEBUG 0
-
-/* Default debugging output file, overridden by envvar UWTHR_DEBUG. */
-
-#define DEBUG_FILE "/dev/tty"
-
-/* #if DEBUG, write string S to the debugging output channel. */
-
-#if !DEBUG
-# define DBG(fmt_and_args)
-# define DBG2(fmt_and_args)
-#else
-# define DBG(fmt_and_args) dbg fmt_and_args
-# define DBG2(fmt_and_args)
-#endif
-
-/* Back end to CALL_BASE() and TRY_BASE(): evaluate CALL, then convert
- inferior_ptid to a composite thread/process id. */
-
-#define CALL_BASE_1(call) \
-do { \
- DBG2(("CALL_BASE(" #call ")")); \
- call; \
- do_cleanups (infpid_cleanup); \
-} while (0)
-
-/* If inferior_ptid can be converted to a composite lwp/process id, do so,
- evaluate base_ops function CALL, and then convert inferior_ptid back to a
- composite thread/process id.
-
- Otherwise, issue an error message and return nonlocally. */
-
-#define CALL_BASE(call) \
-do { \
- if (!lwp_infpid ()) \
- error (_("uw-thread: no lwp")); \
- CALL_BASE_1 (call); \
-} while (0)
-
-/* Like CALL_BASE(), but instead of returning nonlocally on error, set
- *CALLED to whether the inferior_ptid conversion was successful. */
-
-#define TRY_BASE(call, called) \
-do { \
- if ((*(called) = lwp_infpid ())) \
- CALL_BASE_1 (call); \
-} while (0)
-
-/* Information passed by thread_iter() to its callback parameter. */
-
-typedef struct {
- struct thread_map map;
- __lwp_desc_t lwp;
- CORE_ADDR mapp;
-} iter_t;
-
-/* Private thread data for the thread_info struct. */
-
-struct private_thread_info {
- int stable; /* 0 if libthread.so is modifying thread map */
- int thrid; /* thread id assigned by libthread.so */
- int lwpid; /* thread's lwp if .stable, 0 means no lwp */
- CORE_ADDR mapp; /* address of thread's map structure */
-};
-
-
-/* procfs.c's target-specific operations. */
-extern struct target_ops procfs_ops;
-
-/* Flag to prevent procfs.c from starting inferior processes. */
-extern int procfs_suppress_run;
-
-/* This module's target-specific operations. */
-static struct target_ops uw_thread_ops;
-
-/* Copy of the target over which uw_thread_ops is pushed. This is
- more convenient than a pointer to procfs_ops or core_ops, because
- they lack current_target's default callbacks. */
-static struct target_ops base_ops;
-
-/* Saved pointer to previous owner of
- deprecated_target_new_objfile_hook. */
-static void (*target_new_objfile_chain)(struct objfile *);
-
-/* Whether we are debugging a user-space thread program. This isn't
- set until after libthread.so is loaded by the program being
- debugged.
-
- Except for module one-time intialization and where otherwise
- documented, no functions in this module get called when
- !uw_thread_active. */
-static int uw_thread_active;
-
-/* For efficiency, cache the addresses of libthread.so's _thr_debug
- structure, its thr_brk stub function, and the main thread's map. */
-static CORE_ADDR thr_debug_addr;
-static CORE_ADDR thr_brk_addr;
-static CORE_ADDR thr_map_main;
-
-/* Remember the thread most recently marked as switching. Necessary because
- libthread.so passes null map when calling stub with tc_*_complete. */
-static struct thread_info *switchto_thread;
-
-/* Cleanup chain for safely restoring inferior_ptid after CALL_BASE. */
-static struct cleanup *infpid_cleanup;
-
-
-#if DEBUG
-/* Helper function for DBG() macro: if printf-style FMT is non-null, format it
- with args and display the result on the debugging output channel. */
-
-static void
-dbg (char *fmt, ...)
-{
- static int fd = -1, len;
- va_list args;
- char buf[1024];
- char *path;
-
- if (!fmt)
- return;
-
- if (fd < 0)
- {
- path = getenv ("UWTHR_DEBUG");
- if (!path)
- path = DEBUG_FILE;
- if ((fd = open (path, O_WRONLY | O_CREAT | O_TRUNC, 0664)) < 0)
- error (_("can't open %s."), path);
- }
-
- va_start (args, fmt);
- vsprintf (buf, fmt, args);
- va_end (args);
-
- len = strlen (buf);
- buf[len] = '\n';
- (void)write (fd, buf, len + 1);
-}
-
-#if 0
-/* Return a string representing composite PID's components. */
-
-static char *
-dbgpid (ptid_t ptid)
-{
- static char *buf, buf1[80], buf2[80];
- if (!buf || buf == buf2)
- buf = buf1;
- else
- buf = buf2;
-
- if (PIDGET (ptid) <= 0)
- sprintf (buf, "%d", PIDGET (ptid));
- else
- sprintf (buf, "%s %ld/%d", ISTID (pid) ? "thr" : "lwp",
- TIDGET (pid), PIDGET (pid));
-
- return buf;
-}
-
-/* Return a string representing thread state CHANGE. */
-
-static char *
-dbgchange (enum thread_change change)
-{
- switch (change) {
- case tc_invalid: return "invalid";
- case tc_thread_create: return "thread_create";
- case tc_thread_exit: return "thread_exit";
- case tc_switch_begin: return "switch_begin";
- case tc_switch_complete: return "switch_complete";
- case tc_cancel_complete: return "cancel_complete";
- case tc_thread_suspend: return "thread_suspend";
- case tc_thread_suspend_pending: return "thread_suspend_pending";
- case tc_thread_continue: return "thread_continue";
- default: return "unknown";
- }
-}
-
-/* Return a string representing thread STATE. */
-
-static char *
-dbgstate (int state)
-{
- switch (state) {
- case TS_ONPROC: return "running";
- case TS_SLEEP: return "sleeping";
- case TS_RUNNABLE: return "runnable";
- case TS_ZOMBIE: return "zombie";
- case TS_SUSPENDED: return "suspended";
-#ifdef TS_FORK
- case TS_FORK: return "forking";
-#endif
- default: return "confused";
- }
-}
-#endif /* 0 */
-#endif /* DEBUG */
-
-
-/* Read the contents of _thr_debug into *DEBUGP. Return success. */
-
-static int
-read_thr_debug (struct thread_debug *debugp)
-{
- return base_ops.deprecated_xfer_memory (thr_debug_addr, (char *)debugp,
- sizeof (*debugp), 0, NULL,
- &base_ops);
-}
-
-/* Read into MAP the contents of the thread map at inferior process address
- MAPP. Return success. */
-
-static int
-read_map (CORE_ADDR mapp, struct thread_map *map)
-{
- return base_ops.deprecated_xfer_memory ((CORE_ADDR)THR_MAP (mapp),
- (char *)map, sizeof (*map),
- 0, NULL, &base_ops);
-}
-
-/* Read into LWP the contents of the lwp decriptor at inferior process address
- LWPP. Return success. */
-
-static int
-read_lwp (CORE_ADDR lwpp, __lwp_desc_t *lwp)
-{
- return base_ops.deprecated_xfer_memory (lwpp, (char *)lwp,
- sizeof (*lwp), 0, NULL, &base_ops);
-}
-
-/* Iterate through all user threads, applying FUNC(<map>, <lwp>, DATA) until
- (a) FUNC returns nonzero,
- (b) FUNC has been applied to all threads, or
- (c) an error occurs,
- where <map> is the thread's struct thread_map and <lwp> if non-null is the
- thread's current __lwp_desc_t.
-
- If a call to FUNC returns nonzero, return that value; otherwise, return 0. */
-
-static int
-thread_iter (int (*func)(iter_t *, void *), void *data)
-{
- struct thread_debug debug;
- CORE_ADDR first, mapp;
- iter_t iter;
- int ret;
-
- if (!read_thr_debug (&debug))
- return 0;
- if (!base_ops.deprecated_xfer_memory ((CORE_ADDR)debug.thr_map,
- (char *)&mapp, sizeof (mapp), 0, NULL,
- &base_ops))
- return 0;
- if (!mapp)
- return 0;
-
- for (first = mapp;;)
- {
- if (!read_map (mapp, &iter.map))
- return 0;
-
- if (iter.map.thr_lwpp)
- if (!read_lwp ((CORE_ADDR)iter.map.thr_lwpp, &iter.lwp))
- return 0;
-
- iter.mapp = mapp;
- if ((ret = func (&iter, data)))
- return ret;
-
- mapp = (CORE_ADDR)iter.map.thr_next;
- if (mapp == first)
- return 0;
- }
-}
-
-/* Deactivate user-mode thread support. */
-
-static void
-deactivate_uw_thread (void)
-{
- remove_thread_event_breakpoints ();
- uw_thread_active = 0;
- unpush_target (&uw_thread_ops);
-}
-
-/* Return the composite lwp/process id corresponding to composite
- id PID. If PID is a thread with no lwp, return 0. */
-
-static ptid_t
-thr_to_lwp (ptid_t ptid)
-{
- struct thread_info *info;
- ptid_t lid;
-
- if (!ISTID (ptid))
- lid = ptid;
- else if (!(info = find_thread_pid (ptid)))
- lid = null_ptid;
- else if (!info->private->lwpid)
- lid = null_ptid;
- else
- lid = MKLID (PIDGET (ptid), info->private->lwpid);
-
- DBG2((" thr_to_lwp(%s) = %s", dbgpid (pid), dbgpid (lid)));
- return lid;
-}
-
-/* find_thread_lwp() callback: return whether TP describes a thread
- associated with lwp id DATA. */
-
-static int
-find_thread_lwp_callback (struct thread_info *tp, void *data)
-{
- int lwpid = (int)data;
-
- if (!ISTID (tp->ptid))
- return 0;
- if (!tp->private->stable)
- return 0;
- if (lwpid != tp->private->lwpid)
- return 0;
-
- /* match */
- return 1;
-}
-
-/* If a thread is associated with lwp id LWPID, return the corresponding
- member of the global thread list; otherwise, return null. */
-
-static struct thread_info *
-find_thread_lwp (int lwpid)
-{
- return iterate_over_threads (find_thread_lwp_callback, (void *)lwpid);
-}
-
-/* Return the composite thread/process id corresponding to composite
- id PID. If PID is an lwp with no thread, return PID. */
-
-static ptid_t
-lwp_to_thr (ptid_t ptid)
-{
- struct thread_info *info;
- int lwpid;
- ptid_t tid = ptid;
-
- if (ISTID (ptid))
- goto done;
- if (!(lwpid = LIDGET (ptid)))
- goto done;
- if (!(info = find_thread_lwp (lwpid)))
- goto done;
- tid = MKTID (PIDGET (ptid), info->private->thrid);
-
- done:
- DBG2((ISTID (tid) ? NULL : "lwp_to_thr: no thr for %s", dbgpid (ptid)));
- return tid;
-}
-
-/* do_cleanups() callback: convert inferior_ptid to a composite
- thread/process id after having made a procfs call. */
-
-static void
-thr_infpid (void *unused)
-{
- ptid_t ptid = lwp_to_thr (inferior_ptid);
- DBG2((" inferior_ptid from procfs: %s => %s",
- dbgpid (inferior_ptid), dbgpid (ptid)));
- inferior_ptid = ptid;
-}
-
-/* If possible, convert inferior_ptid to a composite lwp/process id in
- preparation for making a procfs call. Return success. */
-
-static int
-lwp_infpid (void)
-{
- ptid_t ptid = thr_to_lwp (inferior_ptid);
- DBG2((" inferior_ptid to procfs: %s => %s",
- dbgpid (inferior_ptid), dbgpid (ptid)));
-
- if (ptid_equal (ptid, null_ptid))
- return 0;
-
- inferior_ptid = ptid;
- infpid_cleanup = make_cleanup (thr_infpid, NULL);
- return 1;
-}
-
-/* Add to the global thread list a new user-mode thread with system id THRID,
- lwp id LWPID, map address MAPP, and composite thread/process PID. */
-
-static void
-add_thread_uw (int thrid, int lwpid, CORE_ADDR mapp, ptid_t ptid)
-{
- struct thread_info *newthread;
-
- if ((newthread = add_thread (ptid)) == NULL)
- error (_("failed to create new thread structure"));
-
- newthread->private = xmalloc (sizeof (struct private_thread_info));
- newthread->private->stable = 1;
- newthread->private->thrid = thrid;
- newthread->private->lwpid = lwpid;
- newthread->private->mapp = mapp;
-
- if (target_has_execution)
- printf_unfiltered ("[New %s]\n", target_pid_to_str (ptid));
-}
-
-/* notice_threads() and find_main() callback: if the thread list doesn't
- already contain the thread described by ITER, add it if it's the main
- thread or if !DATA. */
-
-static int
-notice_thread (iter_t *iter, void *data)
-{
- int thrid = iter->map.thr_tid;
- int lwpid = !iter->map.thr_lwpp ? 0 : iter->lwp.lwp_id;
- ptid_t ptid = MKTID (PIDGET (inferior_ptid), thrid);
-
- if (!find_thread_pid (ptid) && (!data || thrid == 1))
- add_thread_uw (thrid, lwpid, iter->mapp, ptid);
-
- return 0;
-}
-
-/* Add to the thread list any threads it doesn't already contain. */
-
-static void
-notice_threads (void)
-{
- thread_iter (notice_thread, NULL);
-}
-
-/* Return the address of the main thread's map. On error, return 0. */
-
-static CORE_ADDR
-find_main (void)
-{
- if (!thr_map_main)
- {
- struct thread_info *info;
- thread_iter (notice_thread, (void *)1);
- if ((info = find_thread_pid (MKTID (PIDGET (inferior_ptid), 1))))
- thr_map_main = info->private->mapp;
- }
- return thr_map_main;
-}
-
-/* Attach to process specified by ARGS, then initialize for debugging it
- and wait for the trace-trap that results from attaching.
-
- This function only gets called with uw_thread_active == 0. */
-
-static void
-uw_thread_attach (char *args, int from_tty)
-{
- procfs_ops.to_attach (args, from_tty);
- if (uw_thread_active)
- thr_infpid (NULL);
-}
-
-/* Detach from the process attached to by uw_thread_attach(). */
-
-static void
-uw_thread_detach (char *args, int from_tty)
-{
- deactivate_uw_thread ();
- base_ops.to_detach (args, from_tty);
-}
-
-/* Tell the inferior process to continue running thread PID if >= 0
- and all threads otherwise. */
-
-static void
-uw_thread_resume (ptid_t ptid, int step, enum target_signal signo)
-{
- if (PIDGET (ptid) > 0)
- {
- ptid = thr_to_lwp (ptid);
- if (ptid_equal (ptid, null_ptid))
- ptid = pid_to_ptid (-1);
- }
-
- CALL_BASE (base_ops.to_resume (ptid, step, signo));
-}
-
-/* If the trap we just received from lwp PID was due to a breakpoint
- on the libthread.so debugging stub, update this module's state
- accordingly. */
-
-static void
-libthread_stub (ptid_t ptid)
-{
- CORE_ADDR sp, mapp, mapp_main;
- enum thread_change change;
- struct thread_map map;
- __lwp_desc_t lwp;
- int lwpid;
- ptid_t tid = null_ptid;
- struct thread_info *info;
-
- /* Check for stub breakpoint. */
- if (read_pc_pid (ptid) - DECR_PC_AFTER_BREAK != thr_brk_addr)
- return;
-
- /* Retrieve stub args. */
- sp = read_register_pid (SP_REGNUM, ptid);
- if (!base_ops.deprecated_xfer_memory (sp + SP_ARG0, (char *)&mapp,
- sizeof (mapp), 0, NULL, &base_ops))
- goto err;
- if (!base_ops.deprecated_xfer_memory (sp + SP_ARG0 + sizeof (mapp),
- (char *)&change, sizeof (change), 0,
- NULL, &base_ops))
- goto err;
-
- /* create_inferior() may not have finished yet, so notice the main
- thread to ensure that it's displayed first by add_thread(). */
- mapp_main = find_main ();
-
- /* Notice thread creation, deletion, or stability change. */
- switch (change) {
- case tc_switch_begin:
- if (!mapp) /* usually means main thread */
- mapp = mapp_main;
- /* fall through */
-
- case tc_thread_create:
- case tc_thread_exit:
- if (!mapp)
- break;
- if (!read_map (mapp, &map))
- goto err;
- tid = MKTID (PIDGET (ptid), map.thr_tid);
-
- switch (change) {
- case tc_thread_create: /* new thread */
- if (!map.thr_lwpp)
- lwpid = 0;
- else if (!read_lwp ((CORE_ADDR)map.thr_lwpp, &lwp))
- goto err;
- else
- lwpid = lwp.lwp_id;
- add_thread_uw (map.thr_tid, lwpid, mapp, tid);
- break;
-
- case tc_thread_exit: /* thread has exited */
- printf_unfiltered ("[Exited %s]\n", target_pid_to_str (tid));
- delete_thread (tid);
- if (ptid_equal (tid, inferior_ptid))
- inferior_ptid = ptid;
- break;
-
- case tc_switch_begin: /* lwp is switching threads */
- if (switchto_thread)
- goto err;
- if (!(switchto_thread = find_thread_pid (tid)))
- goto err;
- switchto_thread->private->stable = 0;
- break;
-
- default:
- break;
- }
- break;
-
- case tc_switch_complete: /* lwp has switched threads */
- case tc_cancel_complete: /* lwp didn't switch threads */
- if (!switchto_thread)
- goto err;
-
- if (change == tc_switch_complete)
- {
- /* If switchto_thread is the main thread, then (a) the corresponding
- tc_switch_begin probably received a null map argument and therefore
- (b) it may have been a spurious switch following a tc_thread_exit.
-
- Therefore, explicitly query the thread's lwp before caching it in
- its thread list entry. */
-
- if (!read_map (switchto_thread->private->mapp, &map))
- goto err;
- if (map.thr_lwpp)
- {
- if (!read_lwp ((CORE_ADDR)map.thr_lwpp, &lwp))
- goto err;
- if ((info = find_thread_lwp (lwp.lwp_id)))
- info->private->lwpid = 0;
- switchto_thread->private->lwpid = lwp.lwp_id;
- }
- }
-
- switchto_thread->private->stable = 1;
- switchto_thread = NULL;
- break;
-
- case tc_invalid:
- case tc_thread_suspend:
- case tc_thread_suspend_pending:
- case tc_thread_continue:
- err:
- DBG(("unexpected condition in libthread_stub()"));
- break;
- }
-
- DBG2(("libthread_stub(%s): %s %s %s", dbgpid (pid), dbgpid (tid),
- dbgchange (change), tid ? dbgstate (map.thr_state) : ""));
-}
-
-/* Wait for thread/lwp/process ID if >= 0 or for any thread otherwise. */
-
-static ptid_t
-uw_thread_wait (ptid_t ptid, struct target_waitstatus *status)
-{
- if (PIDGET (ptid) > 0)
- ptid = thr_to_lwp (ptid);
- if (PIDGET (ptid) <= 0)
- ptid = pid_to_ptid (-1);
-
- CALL_BASE (ptid = base_ops.to_wait (ptid, status));
-
- if (status->kind == TARGET_WAITKIND_STOPPED &&
- status->value.sig == TARGET_SIGNAL_TRAP)
- libthread_stub (ptid);
-
- return lwp_to_thr (ptid);
-}
-
-/* Tell gdb about the registers in the thread/lwp/process specified by
- inferior_ptid. */
-
-static void
-uw_thread_fetch_registers (int regno)
-{
- int called;
- struct thread_info *info;
- struct thread_map map;
-
- TRY_BASE (base_ops.to_fetch_registers (regno), &called);
- if (called)
- return;
-
- if (!(info = find_thread_pid (inferior_ptid)))
- return;
- if (!read_map (info->private->mapp, &map))
- return;
-
- supply_gregset (&map.thr_ucontext.uc_mcontext.gregs);
- supply_fpregset (&map.thr_ucontext.uc_mcontext.fpregs);
-}
-
-/* Store gdb's current view of the register set into the thread/lwp/process
- specified by inferior_ptid. */
-
-static void
-uw_thread_store_registers (int regno)
-{
- CALL_BASE (base_ops.to_store_registers (regno));
-}
-
-/* Prepare to modify the registers array. */
-
-static void
-uw_thread_prepare_to_store (void)
-{
- CALL_BASE (base_ops.to_prepare_to_store ());
-}
-
-/* Fork an inferior process and start debugging it.
-
- This function only gets called with uw_thread_active == 0. */
-
-static void
-uw_thread_create_inferior (char *exec_file, char *allargs, char **env,
- int from_tty)
-{
- if (uw_thread_active)
- deactivate_uw_thread ();
-
- procfs_ops.to_create_inferior (exec_file, allargs, env, from_tty);
- if (uw_thread_active)
- {
- find_main ();
- thr_infpid (NULL);
- }
-}
-
-/* Kill and forget about the inferior process. */
-
-static void
-uw_thread_kill (void)
-{
- base_ops.to_kill ();
-}
-
-/* Clean up after the inferior exits. */
-
-static void
-uw_thread_mourn_inferior (void)
-{
- deactivate_uw_thread ();
- base_ops.to_mourn_inferior ();
-}
-
-/* Return whether this module can attach to and run processes.
-
- This function only gets called with uw_thread_active == 0. */
-
-static int
-uw_thread_can_run (void)
-{
- return procfs_suppress_run;
-}
-
-/* Return whether thread PID is still valid. */
-
-static int
-uw_thread_alive (ptid_t ptid)
-{
- if (!ISTID (ptid))
- return base_ops.to_thread_alive (ptid);
-
- /* If it's in the thread list, it's valid, because otherwise
- libthread_stub() would have deleted it. */
- return in_thread_list (ptid);
-}
-
-/* Add to the thread list any threads and lwps it doesn't already contain. */
-
-static void
-uw_thread_find_new_threads (void)
-{
- CALL_BASE (if (base_ops.to_find_new_threads)
- base_ops.to_find_new_threads ());
- notice_threads ();
-}
-
-/* Return a string for pretty-printing PID in "info threads" output.
- This may be called by either procfs.c or by generic gdb. */
-
-static char *
-uw_thread_pid_to_str (ptid_t ptid)
-{
-#define FMT "Thread %ld"
- static char buf[sizeof (FMT) + 3 * sizeof (long)];
-
- if (!ISTID (ptid))
- /* core_ops says "process foo", so call procfs_ops explicitly. */
- return procfs_ops.to_pid_to_str (ptid);
-
- sprintf (buf, FMT, TIDGET (ptid));
-#undef FMT
- return buf;
-}
-
-/* Return a string displaying INFO state information in "info threads"
- output. */
-
-static char *
-uw_extra_thread_info (struct thread_info *info)
-{
- static char buf[80];
- struct thread_map map;
- __lwp_desc_t lwp;
- int lwpid;
- char *name;
-
- if (!ISTID (info->ptid))
- return NULL;
-
- if (!info->private->stable)
- return "switching";
-
- if (!read_map (info->private->mapp, &map))
- return NULL;
-
- if (!map.thr_lwpp || !read_lwp ((CORE_ADDR)map.thr_lwpp, &lwp))
- lwpid = 0;
- else
- lwpid = lwp.lwp_id;
-
- switch (map.thr_state) {
- case TS_ONPROC: name = "running"; break;
- case TS_SLEEP: name = "sleeping"; break;
- case TS_RUNNABLE: name = "runnable"; break;
- case TS_ZOMBIE: name = "zombie"; break;
- case TS_SUSPENDED: name = "suspended"; break;
-#ifdef TS_FORK
- case TS_FORK: name = "forking"; break;
-#endif
- default: name = "confused"; break;
- }
-
- if (!lwpid)
- return name;
-
- sprintf (buf, "%s, LWP %d", name, lwpid);
- return buf;
-}
-
-/* Check whether libthread.so has just been loaded, and if so, try to
- initialize user-space thread debugging support.
-
- libthread.so loading happens while (a) an inferior process is being
- started by procfs and (b) a core image is being loaded.
-
- This function often gets called with uw_thread_active == 0. */
-
-static void
-libthread_init (void)
-{
- struct minimal_symbol *ms;
- struct thread_debug debug;
- CORE_ADDR onp;
- struct breakpoint *b;
- int one = 1;
-
- /* Don't initialize twice. */
- if (uw_thread_active)
- return;
-
- /* Check whether libthread.so has been loaded. */
- if (!(ms = lookup_minimal_symbol ("_thr_debug", NULL, NULL)))
- return;
-
- /* Cache _thr_debug's address. */
- if (!(thr_debug_addr = SYMBOL_VALUE_ADDRESS (ms)))
- return;
-
- /* Initialize base_ops.deprecated_xfer_memory(). */
- base_ops = current_target;
-
- /* Load _thr_debug's current contents. */
- if (!read_thr_debug (&debug))
- return;
-
- /* User code (e.g. my test programs) may dereference _thr_debug,
- making it availble to GDB before shared libs are loaded. */
- if (!debug.thr_map)
- return;
-
- /* libthread.so has been loaded, and the current_target should now
- reflect core_ops or procfs_ops. */
- push_target (&uw_thread_ops); /* must precede notice_threads() */
- uw_thread_active = 1;
-
- if (!target_has_execution)
-
- /* Locate threads in core file. */
- notice_threads ();
-
- else
- {
- /* Set a breakpoint on the stub function provided by libthread.so. */
- thr_brk_addr = (CORE_ADDR)debug.thr_brk;
- if (!(b = create_thread_event_breakpoint (thr_brk_addr)))
- goto err;
-
- /* Activate the stub function. */
- onp = (CORE_ADDR)&((struct thread_debug *)thr_debug_addr)->thr_debug_on;
- if (!base_ops.deprecated_xfer_memory ((CORE_ADDR)onp, (char *)&one,
- sizeof (one), 1, NULL, &base_ops))
- {
- delete_breakpoint (b);
- goto err;
- }
-
- /* Prepare for finding the main thread, which doesn't yet exist. */
- thr_map_main = 0;
- }
-
- return;
-
- err:
- warning (_("uw-thread: unable to initialize user-mode thread debugging."));
- deactivate_uw_thread ();
-}
-
-/* deprecated_target_new_objfile_hook callback.
-
- If OBJFILE is non-null, check whether libthread.so was just loaded,
- and if so, prepare for user-mode thread debugging.
-
- If OBJFILE is null, libthread.so has gone away, so stop debugging
- user-mode threads.
-
- This function often gets called with uw_thread_active == 0. */
-
-static void
-uw_thread_new_objfile (struct objfile *objfile)
-{
- if (objfile)
- libthread_init ();
-
- else if (uw_thread_active)
- deactivate_uw_thread ();
-
- if (target_new_objfile_chain)
- target_new_objfile_chain (objfile);
-}
-
-/* Initialize uw_thread_ops. */
-
-static void
-init_uw_thread_ops (void)
-{
- uw_thread_ops.to_shortname = "unixware-threads";
- uw_thread_ops.to_longname = "UnixWare threads and pthread.";
- uw_thread_ops.to_doc = "UnixWare threads and pthread support.";
- uw_thread_ops.to_attach = uw_thread_attach;
- uw_thread_ops.to_detach = uw_thread_detach;
- uw_thread_ops.to_resume = uw_thread_resume;
- uw_thread_ops.to_wait = uw_thread_wait;
- uw_thread_ops.to_fetch_registers = uw_thread_fetch_registers;
- uw_thread_ops.to_store_registers = uw_thread_store_registers;
- uw_thread_ops.to_prepare_to_store = uw_thread_prepare_to_store;
- uw_thread_ops.to_create_inferior = uw_thread_create_inferior;
- uw_thread_ops.to_kill = uw_thread_kill;
- uw_thread_ops.to_mourn_inferior = uw_thread_mourn_inferior;
- uw_thread_ops.to_can_run = uw_thread_can_run;
- uw_thread_ops.to_thread_alive = uw_thread_alive;
- uw_thread_ops.to_find_new_threads = uw_thread_find_new_threads;
- uw_thread_ops.to_pid_to_str = uw_thread_pid_to_str;
- uw_thread_ops.to_extra_thread_info = uw_extra_thread_info;
- uw_thread_ops.to_stratum = thread_stratum;
- uw_thread_ops.to_magic = OPS_MAGIC;
-}
-
-/* Module startup initialization function, automagically called by
- init.c. */
-
-void
-_initialize_uw_thread (void)
-{
- init_uw_thread_ops ();
- add_target (&uw_thread_ops);
-
- procfs_suppress_run = 1;
-
- /* Notice when libthread.so gets loaded. */
- target_new_objfile_chain = deprecated_target_new_objfile_hook;
- deprecated_target_new_objfile_hook = uw_thread_new_objfile;
-}