* fork-child.c (fork_inferior), remote-eb.c (eb_create_inferior),

remote-mon.c (monitor_create_inferior), remote-nindy.c
	(nindy_create_inferior), remote-st.c (st2000_create_inferior),
	remote-vx.c (vx_create_inferior): Remove CREATE_INFERIOR_HOOK; it
	is replaced by init_trace_fun.
	* config/convex/xm-convex.h, convex-xdep.c: Add comments explaining
	how to do without CREATE_INFERIOR_HOOK for whoever fixes the Convex
	port.

	* Makefile.in: Add Mach files to ALLDEPFILES, etc.
	* m3-nat.c: Clean up more hair--message(), cprocs.
	* configure.in: Recognize Mach targets and hosts.
	* config/ns32k/tm-umax.h: Add some #ifndef's so tm-ns32km3.h can
	include this file.
	* Mach headers in config/*/tm-*.h: Fix includes to match correct
	locations of files.
This commit is contained in:
Jim Kingdon 1993-10-15 04:26:06 +00:00
parent 8c4731b588
commit 5d76c8e662
16 changed files with 301 additions and 213 deletions

View File

@ -1,3 +1,22 @@
Thu Oct 14 20:34:15 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* fork-child.c (fork_inferior), remote-eb.c (eb_create_inferior),
remote-mon.c (monitor_create_inferior), remote-nindy.c
(nindy_create_inferior), remote-st.c (st2000_create_inferior),
remote-vx.c (vx_create_inferior): Remove CREATE_INFERIOR_HOOK; it
is replaced by init_trace_fun.
* config/convex/xm-convex.h, convex-xdep.c: Add comments explaining
how to do without CREATE_INFERIOR_HOOK for whoever fixes the Convex
port.
* Makefile.in: Add Mach files to ALLDEPFILES, etc.
* m3-nat.c: Clean up more hair--message(), cprocs.
* configure.in: Recognize Mach targets and hosts.
* config/ns32k/tm-umax.h: Add some #ifndef's so tm-ns32km3.h can
include this file.
* Mach headers in config/*/tm-*.h: Fix includes to match correct
locations of files.
Thu Oct 14 21:35:55 1993 Rob Savoye (rob@darkstar.cygnus.com) Thu Oct 14 21:35:55 1993 Rob Savoye (rob@darkstar.cygnus.com)
* remote-mon.c (general_open): Set dev_name. Minor tweaking to get * remote-mon.c (general_open): Set dev_name. Minor tweaking to get

View File

@ -373,7 +373,7 @@ HFILES = buildsym.h call-cmds.h defs.h environ.h $(gdbcmd_h) \
config/m68k/tm-m68k.h config/pa/tm-hppa.h config/i960/tm-i960.h \ config/m68k/tm-m68k.h config/pa/tm-hppa.h config/i960/tm-i960.h \
config/sparc/tm-sparc.h config/tm-sunos.h config/tm-sysv4.h \ config/sparc/tm-sparc.h config/tm-sunos.h config/tm-sysv4.h \
config/m68k/xm-m68k.h config/sparc/xm-sparc.h config/xm-sysv4.h \ config/m68k/xm-m68k.h config/sparc/xm-sparc.h config/xm-sysv4.h \
config/vax/xm-vax.h config/nm-trash.h $(udiheaders) \ config/vax/xm-vax.h config/nm-m3.h config/nm-trash.h $(udiheaders) \
29k-share/udi/udiids.h 29k-share/udi_soc nindy-share/b.out.h \ 29k-share/udi/udiids.h 29k-share/udi_soc nindy-share/b.out.h \
nindy-share/block_io.h nindy-share/coff.h \ nindy-share/block_io.h nindy-share/coff.h \
nindy-share/env.h nindy-share/stop.h \ nindy-share/env.h nindy-share/stop.h \
@ -561,7 +561,6 @@ kdb: $(NTSSTART) $(OBS) $(NTSOBS) $(ADD_DEPS) $(CDEPS)
# Put the proper machine-specific files first, so M-. on a machine # Put the proper machine-specific files first, so M-. on a machine
# specific routine gets the one for the correct machine. # specific routine gets the one for the correct machine.
# The xyzzy stuff below deals with empty DEPFILES
TAGS: TAGS:
etags `find $(srcdir)/config \( -name $(TM_FILE) \ etags `find $(srcdir)/config \( -name $(TM_FILE) \
-o -name $(XM_FILE) \ -o -name $(XM_FILE) \
@ -812,22 +811,27 @@ ALLDEPFILES = 29k-share/udi/udip2soc.c 29k-share/udi/udr.c \
go32-xdep.c gould-pinsn.c gould-xdep.c h8300-tdep.c h8500-tdep.c \ go32-xdep.c gould-pinsn.c gould-xdep.c h8300-tdep.c h8500-tdep.c \
hp300ux-nat.c hppa-pinsn.c hppa-tdep.c hppab-nat.c hppah-nat.c \ hp300ux-nat.c hppa-pinsn.c hppa-tdep.c hppab-nat.c hppah-nat.c \
i386-pinsn.c i386-tdep.c i386b-nat.c i386mach-nat.c i386v-nat.c \ i386-pinsn.c i386-tdep.c i386b-nat.c i386mach-nat.c i386v-nat.c \
i386aix-nat.c i386v4-nat.c i386lynx-nat.c i386ly-tdep.c i387-tdep.c \ i386aix-nat.c i386m3-nat.c i386v4-nat.c i386lynx-nat.c i386ly-tdep.c \
i387-tdep.c \
i960-pinsn.c i960-tdep.c \ i960-pinsn.c i960-tdep.c \
infptrace.c inftarg.c irix4-nat.c isi-xdep.c m68k-pinsn.c m68k-tdep.c \ infptrace.c inftarg.c irix4-nat.c isi-xdep.c m3-nat.c \
m68k-pinsn.c m68k-tdep.c \
m88k-nat.c m88k-pinsn.c m88k-tdep.c mips-nat.c mips-pinsn.c \ m88k-nat.c m88k-pinsn.c m88k-tdep.c mips-nat.c mips-pinsn.c \
mips-tdep.c news-xdep.c nindy-share/Onindy.c nindy-share/nindy.c \ mips-tdep.c mipsm3-nat.c news-xdep.c \
nindy-share/Onindy.c nindy-share/nindy.c \
nindy-share/ttyflush.c nindy-tdep.c \ nindy-share/ttyflush.c nindy-tdep.c \
ns32k-pinsn.c osfsolib.c \ ns32k-pinsn.c ns32km3-nat.c osfsolib.c \
paread.c procfs.c pyr-pinsn.c pyr-tdep.c pyr-xdep.c \ paread.c procfs.c pyr-pinsn.c pyr-tdep.c pyr-xdep.c \
remote-adapt.c remote-bug.c remote-eb.c remote-es.c remote-hms.c remote-mips.c \ remote-adapt.c remote-bug.c remote-eb.c remote-es.c \
remote-hms.c remote-mips.c \
remote-mm.c remote-mon.c remote-nindy.c remote-sim.c \ remote-mm.c remote-mon.c remote-nindy.c remote-sim.c \
remote-st.c remote-utils.c dcache.c \ remote-st.c remote-utils.c dcache.c \
remote-udi.c remote-vx.c remote-z8k.c rs6000-nat.c rs6000-pinsn.c \ remote-udi.c remote-vx.c remote-z8k.c rs6000-nat.c rs6000-pinsn.c \
rs6000-tdep.c ser-go32.c ser-tcp.c sh-tdep.c solib.c sparc-nat.c \ rs6000-tdep.c ser-go32.c ser-tcp.c sh-tdep.c solib.c sparc-nat.c \
sparc-pinsn.c sparc-tdep.c sun3-nat.c sun386-nat.c symm-tdep.c \ sparc-pinsn.c sparc-tdep.c sun3-nat.c sun386-nat.c symm-tdep.c \
symm-nat.c tahoe-pinsn.c ultra3-nat.c ultra3-xdep.c umax-xdep.c \ symm-nat.c tahoe-pinsn.c ultra3-nat.c ultra3-xdep.c umax-xdep.c \
vax-pinsn.c vx-share/xdr_ld.c vx-share/xdr_ptrace.c vx-share/xdr_rdb.c \ vax-pinsn.c \
vx-share/xdr_ld.c vx-share/xdr_ptrace.c vx-share/xdr_rdb.c \
xcoffexec.c xcoffread.c xcoffsolib.c z8k-tdep.c xcoffexec.c xcoffread.c xcoffsolib.c z8k-tdep.c
ALLPARAM = config/a29k/nm-ultra3.h config/a29k/tm-a29k.h \ ALLPARAM = config/a29k/nm-ultra3.h config/a29k/tm-a29k.h \
@ -844,13 +848,15 @@ ALLPARAM = config/a29k/nm-ultra3.h config/a29k/tm-a29k.h \
config/i386/nm-i386v4.h config/i386/nm-linux.h \ config/i386/nm-i386v4.h config/i386/nm-linux.h \
config/i386/nm-sun386.h config/i386/nm-symmetry.h \ config/i386/nm-sun386.h config/i386/nm-symmetry.h \
config/i386/tm-i386aix.h config/i386/tm-i386bsd.h \ config/i386/tm-i386aix.h config/i386/tm-i386bsd.h \
config/i386/tm-i386lynx.h config/i386/tm-i386nw.h \ config/i386/tm-i386lynx.h config/i386/tm-i386m3.h \
config/i386/tm-i386mk.hconfig/i386/tm-i386nw.h \
config/i386/tm-i386v.h \ config/i386/tm-i386v.h \
config/i386/tm-i386v4.h config/i386/tm-linux.h \ config/i386/tm-i386v4.h config/i386/tm-linux.h \
config/i386/tm-sun386.h \ config/i386/tm-sun386.h \
config/i386/tm-symmetry.h config/i386/xm-go32.h \ config/i386/tm-symmetry.h config/i386/xm-go32.h \
config/i386/xm-i386aix.h config/i386/xm-i386bsd.h \ config/i386/xm-i386aix.h config/i386/xm-i386bsd.h \
config/i386/xm-i386lynx.h config/i386/xm-i386mach.h \ config/i386/xm-i386lynx.h config/i386/xm-i386mach.h \
config/i386/xm-i386m3.h config/i386/xm-i386mk.h \
config/i386/xm-i386sco.h config/i386/xm-i386v.h \ config/i386/xm-i386sco.h config/i386/xm-i386v.h \
config/i386/xm-i386v32.h config/i386/xm-i386v4.h \ config/i386/xm-i386v32.h config/i386/xm-i386v4.h \
config/i386/xm-linux.h config/i386/xm-sun386.h \ config/i386/xm-linux.h config/i386/xm-sun386.h \
@ -879,13 +885,18 @@ ALLPARAM = config/a29k/nm-ultra3.h config/a29k/tm-a29k.h \
config/m88k/xm-delta88.h config/m88k/xm-m88k.h config/mips/nm-irix3.h \ config/m88k/xm-delta88.h config/m88k/xm-m88k.h config/mips/nm-irix3.h \
config/mips/nm-irix4.h config/mips/nm-mips.h config/mips/nm-riscos.h \ config/mips/nm-irix4.h config/mips/nm-mips.h config/mips/nm-riscos.h \
config/mips/nm-news-mips.h config/mips/tm-bigmips.h \ config/mips/nm-news-mips.h config/mips/tm-bigmips.h \
config/mips/tm-irix3.h config/mips/tm-mips.h config/mips/xm-irix3.h \ config/mips/tm-irix3.h config/mips/tm-mips.h config/mips/tm-mipsm3.h \
config/mips/xm-irix3.h \
config/mips/xm-irix4.h config/mips/xm-makeva.h config/mips/xm-mips.h \ config/mips/xm-irix4.h config/mips/xm-makeva.h config/mips/xm-mips.h \
config/mips/xm-mipsm3.h \
config/mips/xm-riscos.h config/mips/xm-news-mips.h config/nm-sysv4.h \ config/mips/xm-riscos.h config/mips/xm-news-mips.h config/nm-sysv4.h \
config/none/nm-none.h config/none/tm-none.h config/none/xm-none.h \ config/none/nm-none.h config/none/tm-none.h config/none/xm-none.h \
config/ns32k/nm-umax.h config/ns32k/tm-merlin.h \ config/ns32k/nm-umax.h \
config/ns32k/tm-umax.h \ config/ns32k/tm-ns32km3.h \
config/ns32k/xm-merlin.h config/ns32k/xm-umax.h config/pa/nm-hppab.h \ config/ns32k/tm-merlin.h config/ns32k/tm-umax.h \
config/ns32k/xm-ns32km3.h \
config/ns32k/xm-merlin.h config/ns32k/xm-umax.h \
config/pa/nm-hppab.h \
config/pa/nm-hppah.h config/pa/tm-hppab.h config/pa/tm-hppah.h \ config/pa/nm-hppah.h config/pa/tm-hppab.h config/pa/tm-hppah.h \
config/pa/xm-hppab.h config/pa/xm-hppah.h config/pa/xm-pa.h \ config/pa/xm-hppab.h config/pa/xm-hppah.h config/pa/xm-pa.h \
config/pyr/tm-pyr.h \ config/pyr/tm-pyr.h \

View File

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Include common definitions for Mach3 systems */ /* Include common definitions for Mach3 systems */
#include "os-mach3.h" #include "nm-m3.h"
/* Define offsets to access CPROC stack when it does not have /* Define offsets to access CPROC stack when it does not have
* a kernel thread. * a kernel thread.
@ -57,15 +57,12 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define NAMES_HAVE_UNDERSCORE #define NAMES_HAVE_UNDERSCORE
/* Sigh. There should be a file for i386 but no sysv stuff in it */ /* Sigh. There should be a file for i386 but no sysv stuff in it */
#include "tm-i386v.h" #include "i386/tm-i386v.h"
/* I want to test this float info code. See comment in tm-i386v.h */ /* I want to test this float info code. See comment in tm-i386v.h */
#undef FLOAT_INFO #undef FLOAT_INFO
#define FLOAT_INFO { i386_mach3_float_info (); } #define FLOAT_INFO { i386_mach3_float_info (); }
/* We use a.out format */
#undef COFF_NO_LONG_FILE_NAMES
/* Address of end of stack space. /* Address of end of stack space.
* for MACH, see <machine/vmparam.h> * for MACH, see <machine/vmparam.h>
* @@@ I don't know what is in the 5 ints... * @@@ I don't know what is in the 5 ints...

View File

@ -22,4 +22,4 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/ */
#define MK67 1 #define MK67 1
#include "tm-i386mach3.h" #include "i386/tm-i386m3.h"

View File

@ -24,7 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/ */
/* Include common definitions for Mach3 systems */ /* Include common definitions for Mach3 systems */
#include "os-mach3.h" #include "nm-m3.h"
/* Define offsets to access CPROC stack when it does not have /* Define offsets to access CPROC stack when it does not have
* a kernel thread. * a kernel thread.
@ -54,7 +54,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Mach supports attach/detach */ /* Mach supports attach/detach */
#define ATTACH_DETACH 1 #define ATTACH_DETACH 1
#include "tm-mips.h" #include "mips/tm-mips.h"
/* /*
* On Mach 3.0 this is the number of exec() system calls before * On Mach 3.0 this is the number of exec() system calls before

View File

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Include common definitions for Mach3 systems */ /* Include common definitions for Mach3 systems */
#include "os-mach3.h" #include "nm-m3.h"
/* Define offsets to access CPROC stack when it does not have /* Define offsets to access CPROC stack when it does not have
* a kernel thread. * a kernel thread.
@ -61,4 +61,4 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/ */
#define STACK_END_ADDR USRSTACK #define STACK_END_ADDR USRSTACK
#include "tm-umax.h" #include "ns32k/tm-umax.h"

View File

@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This is also included by tm-ns32km3.h, as well as being used by umax. */
#define TARGET_BYTE_ORDER LITTLE_ENDIAN #define TARGET_BYTE_ORDER LITTLE_ENDIAN
/* Need to get function ends by adding this to epilogue address from .bf /* Need to get function ends by adding this to epilogue address from .bf
@ -50,7 +52,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Address of end of stack space. */ /* Address of end of stack space. */
#ifndef STACK_END_ADDR
#define STACK_END_ADDR (0xfffff000) #define STACK_END_ADDR (0xfffff000)
#endif
/* Stack grows downward. */ /* Stack grows downward. */
@ -70,6 +74,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0x12) #define ABOUT_TO_RETURN(pc) (read_memory_integer (pc, 1) == 0x12)
#ifndef INVALID_FLOAT
#ifndef NaN #ifndef NaN
#include <nan.h> #include <nan.h>
#endif NaN #endif NaN
@ -80,6 +85,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
((s == sizeof (float))? \ ((s == sizeof (float))? \
NaF (*(float *) p) : \ NaF (*(float *) p) : \
NaD (*(double *) p)) NaD (*(double *) p))
#endif /* INVALID_FLOAT */
/* Say how long (ordinary) registers are. */ /* Say how long (ordinary) registers are. */

View File

@ -45,7 +45,10 @@ i[34]86-*-netbsd*) gdb_host=i386bsd ;;
i[34]86-*-go32) gdb_host=go32 ;; i[34]86-*-go32) gdb_host=go32 ;;
i[34]86-*-linux) gdb_host=linux ;; i[34]86-*-linux) gdb_host=linux ;;
i[34]86-*-lynx*) gdb_host=i386lynx ;; i[34]86-*-lynx*) gdb_host=i386lynx ;;
i[34]86-*-mach) gdb_host=i386mach ;; # Obsolete I suspect
# i[34]86-*-mach) gdb_host=i386mach ;;
i[34]86-*-mach*) gdb_host=i386m3 ;;
i[34]86-*-osf1mk*) gdb_host=i386mk ;;
i[34]86-*-sco3.2v4*) gdb_host=i386sco4 ;; i[34]86-*-sco3.2v4*) gdb_host=i386sco4 ;;
i[34]86-*-sco*) gdb_host=i386sco ;; i[34]86-*-sco*) gdb_host=i386sco ;;
i[34]86-*-solaris*) gdb_host=i386sol2 ;; i[34]86-*-solaris*) gdb_host=i386sol2 ;;
@ -86,6 +89,7 @@ mips-sgi-irix4*) gdb_host=irix4 ;;
mips-sony-*) gdb_host=news-mips ;; mips-sony-*) gdb_host=news-mips ;;
mips-*-sysv*) gdb_host=riscos ;; mips-*-sysv*) gdb_host=riscos ;;
mips-*-riscos*) gdb_host=riscos ;; mips-*-riscos*) gdb_host=riscos ;;
mips-*-mach*) gdb_host=mipsm3 ;;
none-*-*) gdb_host=none ;; none-*-*) gdb_host=none ;;
@ -198,7 +202,9 @@ i[34]86-*-sco*) gdb_target=i386v ;;
i[34]86-*-sysv*) gdb_target=i386v ;; i[34]86-*-sysv*) gdb_target=i386v ;;
i[34]86-*-linux*) gdb_target=linux ;; i[34]86-*-linux*) gdb_target=linux ;;
i[34]86-*-isc*) gdb_target=i386v ;; i[34]86-*-isc*) gdb_target=i386v ;;
i[34]86-*-mach*) gdb_target=i386m3 ;;
i[34]86-*-netware*) gdb_target=i386nw ;; i[34]86-*-netware*) gdb_target=i386nw ;;
i[34]86-*-osf1mk*) gdb_target=i386mk ;;
i960-*-bout) gdb_target=vxworks960 ;; i960-*-bout) gdb_target=vxworks960 ;;
i960-*-coff) gdb_target=nindy960 ;; i960-*-coff) gdb_target=nindy960 ;;
@ -249,6 +255,7 @@ mips-sgi-*) gdb_target=irix3 ;;
mips-sony-*) gdb_target=bigmips ;; mips-sony-*) gdb_target=bigmips ;;
mips-*-sysv*) gdb_target=bigmips ;; mips-*-sysv*) gdb_target=bigmips ;;
mips-*-riscos*) gdb_target=bigmips ;; mips-*-riscos*) gdb_target=bigmips ;;
mips-*-mach*) gdb_target=mipsm3 ;;
none-*-*) gdb_target=none ;; none-*-*) gdb_target=none ;;

View File

@ -306,6 +306,9 @@ write_inferior_memory (memaddr, myaddr, len)
and started up. We must do a pattach to grab it for debugging. and started up. We must do a pattach to grab it for debugging.
Also, intercept the CONT command by altering its dispatch address. */ Also, intercept the CONT command by altering its dispatch address. */
/* FIXME: This used to be called from a macro CREATE_INFERIOR_HOOK.
But now init_trace_fun is in the same place. So re-write this to
use the init_trace_fun (making convex a debugging target). */
create_inferior_hook (pid) create_inferior_hook (pid)
int pid; int pid;

View File

@ -244,13 +244,9 @@ fork_inferior (exec_file, allargs, env, traceme_fun, init_trace_fun)
init_thread_list(); init_thread_list();
#ifdef CREATE_INFERIOR_HOOK /* The process was started by the fork that created it,
CREATE_INFERIOR_HOOK (pid); but it will have stopped one instruction after execing the shell.
#endif Here we must get it up to actual execution of the real program. */
/* The process was started by the fork that created it,
but it will have stopped one instruction after execing the shell.
Here we must get it up to actual execution of the real program. */
inferior_pid = pid; /* Needed for wait_for_inferior stuff below */ inferior_pid = pid; /* Needed for wait_for_inferior stuff below */

View File

@ -67,14 +67,44 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <cthreads.h> #include <cthreads.h>
/* /* This is what a cproc looks like. This is here partly because
* Mis-use the struct cproc busy field in the copy of cthread_internals.h is not a header we can just #include, partly with
* the cproc in gdb's address space. an eye towards perhaps getting this to work with cross-debugging
* someday. Best solution is if CMU publishes a real interface to this
* This *can* be done otherwise, but I'm too lazy. stuff. */
* (Don't tell anyone :-) #define CPROC_NEXT_OFFSET 0
*/ #define CPROC_NEXT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT)
#define CPROC_REVERSE_MAP(x) ((x)->busy) #define CPROC_INCARNATION_OFFSET (CPROC_NEXT_OFFSET + CPROC_NEXT_SIZE)
#define CPROC_INCARNATION_SIZE (sizeof (cthread_t))
#define CPROC_LIST_OFFSET (CPROC_INCARNATION_OFFSET + CPROC_INCARNATION_SIZE)
#define CPROC_LIST_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT)
#define CPROC_WAIT_OFFSET (CPROC_LIST_OFFSET + CPROC_LIST_SIZE)
#define CPROC_WAIT_SIZE (TARGET_PTR_BIT / HOST_CHAR_BIT)
#define CPROC_REPLY_OFFSET (CPROC_WAIT_OFFSET + CPROC_WAIT_SIZE)
#define CPROC_REPLY_SIZE (sizeof (mach_port_t))
#define CPROC_CONTEXT_OFFSET (CPROC_REPLY_OFFSET + CPROC_REPLY_SIZE)
#define CPROC_CONTEXT_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
#define CPROC_LOCK_OFFSET (CPROC_CONTEXT_OFFSET + CPROC_CONTEXT_SIZE)
#define CPROC_LOCK_SIZE (sizeof (spin_lock_t))
#define CPROC_STATE_OFFSET (CPROC_LOCK_OFFSET + CPROC_LOCK_SIZE)
#define CPROC_STATE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
#define CPROC_WIRED_OFFSET (CPROC_STATE_OFFSET + CPROC_STATE_SIZE)
#define CPROC_WIRED_SIZE (sizeof (mach_port_t))
#define CPROC_BUSY_OFFSET (CPROC_WIRED_OFFSET + CPROC_WIRED_SIZE)
#define CPROC_BUSY_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
#define CPROC_MSG_OFFSET (CPROC_BUSY_OFFSET + CPROC_BUSY_SIZE)
#define CPROC_MSG_SIZE (sizeof (mach_msg_header_t))
#define CPROC_BASE_OFFSET (CPROC_MSG_OFFSET + CPROC_MSG_SIZE)
#define CPROC_BASE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
#define CPROC_SIZE_OFFSET (CPROC_BASE_OFFSET + CPROC_BASE_SIZE)
#define CPROC_SIZE_SIZE (TARGET_INT_BIT / HOST_CHAR_BIT)
#define CPROC_SIZE (CPROC_SIZE_OFFSET + CPROC_SIZE_SIZE)
/* Values for the state field in the cproc. */
#define CPROC_RUNNING 0
#define CPROC_SWITCHING 1
#define CPROC_BLOCKED 2
#define CPROC_CONDWAIT 4
/* For cproc and kernel thread mapping */ /* For cproc and kernel thread mapping */
typedef struct gdb_thread { typedef struct gdb_thread {
@ -82,9 +112,23 @@ typedef struct gdb_thread {
CORE_ADDR sp; CORE_ADDR sp;
CORE_ADDR pc; CORE_ADDR pc;
CORE_ADDR fp; CORE_ADDR fp;
cproc_t cproc;
boolean_t in_emulator; boolean_t in_emulator;
int slotid; int slotid;
/* This is for the mthreads list. It points to the cproc list.
Perhaps the two lists should be merged (or perhaps it was a mistake
to make them both use a struct gdb_thread). */
struct gdb_thread *cproc;
/* These are for the cproc list, which is linked through the next field
of the struct gdb_thread. */
char raw_cproc[CPROC_SIZE];
/* The cthread which is pointed to by the incarnation field from the
cproc. This points to the copy we've read into GDB. */
cthread_t cthread;
/* Point back to the mthreads list. */
int reverse_map;
struct gdb_thread *next;
} *gdb_thread_t; } *gdb_thread_t;
/* /*
@ -136,7 +180,7 @@ char *fmt;
int a,b,c; int a,b,c;
{ {
if (debug_level) if (debug_level)
message (fmt, a, b, c); warning (fmt, a, b, c);
} }
/* This is in libmach.a */ /* This is in libmach.a */
@ -253,7 +297,7 @@ port_chain_insert (list, name, type)
{ {
if (! MACH_PORT_VALID (mid_server)) if (! MACH_PORT_VALID (mid_server))
{ {
message ("Machid server port invalid, can not map port 0x%x to MID", warning ("Machid server port invalid, can not map port 0x%x to MID",
name); name);
mid = name; mid = name;
} }
@ -263,7 +307,7 @@ port_chain_insert (list, name, type)
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Can not map name (0x%x) to MID with machid", name); warning ("Can not map name (0x%x) to MID with machid", name);
mid = name; mid = name;
} }
} }
@ -342,7 +386,7 @@ int type;
if (! MACH_PORT_VALID (mid_server)) if (! MACH_PORT_VALID (mid_server))
{ {
message ("Machid server port invalid, can not map port 0x%x to mid", warning ("Machid server port invalid, can not map port 0x%x to mid",
name); name);
return -1; return -1;
} }
@ -355,7 +399,7 @@ int type;
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Can not map name (0x%x) to mid with machid", name); warning ("Can not map name (0x%x) to mid with machid", name);
return -1; return -1;
} }
return mid; return mid;
@ -394,7 +438,7 @@ setup_single_step (thread, start_step)
{ {
if (MACH_PORT_VALID (singlestepped_thread_port)) if (MACH_PORT_VALID (singlestepped_thread_port))
{ {
message ("Singlestepped_thread_port (0x%x) is still valid?", warning ("Singlestepped_thread_port (0x%x) is still valid?",
singlestepped_thread_port); singlestepped_thread_port);
singlestepped_thread_port = MACH_PORT_NULL; singlestepped_thread_port = MACH_PORT_NULL;
} }
@ -941,7 +985,7 @@ select_thread (task, thread_id, flag)
ret = task_threads (task, &thread_list, &thread_count); ret = task_threads (task, &thread_list, &thread_count);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Can not select a thread from a dead task"); warning ("Can not select a thread from a dead task");
kill_inferior (); kill_inferior ();
return KERN_FAILURE; return KERN_FAILURE;
} }
@ -952,7 +996,7 @@ select_thread (task, thread_id, flag)
* exists as a container for memory and ports. * exists as a container for memory and ports.
*/ */
registers_changed (); registers_changed ();
message ("Task %d has no threads", warning ("Task %d has no threads",
map_port_name_to_mid (task, MACH_TYPE_TASK)); map_port_name_to_mid (task, MACH_TYPE_TASK));
current_thread = MACH_PORT_NULL; current_thread = MACH_PORT_NULL;
(void) vm_deallocate(mach_task_self(), (void) vm_deallocate(mach_task_self(),
@ -1055,7 +1099,7 @@ switch_to_thread (new_thread)
mid = map_port_name_to_mid (new_thread, mid = map_port_name_to_mid (new_thread,
MACH_TYPE_THREAD); MACH_TYPE_THREAD);
if (mid == -1) if (mid == -1)
message ("Can't map thread name 0x%x to mid", new_thread); warning ("Can't map thread name 0x%x to mid", new_thread);
else if (select_thread (inferior_task, mid, 1) != KERN_SUCCESS) else if (select_thread (inferior_task, mid, 1) != KERN_SUCCESS)
{ {
if (current_thread) if (current_thread)
@ -1224,7 +1268,7 @@ mach_really_wait (w)
(WIFEXITED(*w) && WEXITSTATUS(*w) > 0377)) (WIFEXITED(*w) && WEXITSTATUS(*w) > 0377))
{ {
WSETEXIT(*w, 0); WSETEXIT(*w, 0);
message ("Using exit value 0 for terminated task"); warning ("Using exit value 0 for terminated task");
} }
else if (!WIFEXITED(*w)) else if (!WIFEXITED(*w))
{ {
@ -1232,11 +1276,11 @@ mach_really_wait (w)
/* Signals cause problems. Warn the user. */ /* Signals cause problems. Warn the user. */
if (sig != SIGKILL) /* Bad luck if garbage matches this */ if (sig != SIGKILL) /* Bad luck if garbage matches this */
message ("The terminating signal stuff may be nonsense"); warning ("The terminating signal stuff may be nonsense");
else if (sig > NSIG) else if (sig > NSIG)
{ {
WSETEXIT(*w, 0); WSETEXIT(*w, 0);
message ("Using exit value 0 for terminated task"); warning ("Using exit value 0 for terminated task");
} }
} }
return inferior_pid; return inferior_pid;
@ -1293,7 +1337,7 @@ mach3_quit ()
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Could not suspend task for interrupt: %s", warning ("Could not suspend task for interrupt: %s",
mach_error_string (ret)); mach_error_string (ret));
mach_really_waiting = 0; mach_really_waiting = 0;
return; return;
@ -1306,7 +1350,7 @@ mach3_quit ()
mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD); mid = map_port_name_to_mid (current_thread, MACH_TYPE_THREAD);
if (mid == -1) if (mid == -1)
{ {
message ("Selecting first existing kernel thread"); warning ("Selecting first existing kernel thread");
mid = 0; mid = 0;
} }
@ -1349,7 +1393,7 @@ gdb_message_server (InP)
case GDB_MESSAGE_ID_STOP: case GDB_MESSAGE_ID_STOP:
ret = task_suspend (inferior_task); ret = task_suspend (inferior_task);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("Could not suspend task for stop message: %s", warning ("Could not suspend task for stop message: %s",
mach_error_string (ret)); mach_error_string (ret));
/* QUIT in mach_really_wait() loop. */ /* QUIT in mach_really_wait() loop. */
@ -1357,7 +1401,7 @@ gdb_message_server (InP)
break; break;
default: default:
message ("Invalid message id %d received, ignored.", warning ("Invalid message id %d received, ignored.",
InP->msgh_id); InP->msgh_id);
break; break;
} }
@ -1646,7 +1690,7 @@ catch_exception_raise (port, thread, task, exception, code, subcode)
if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS) if (select_thread (inferior_task, mid, 0) != KERN_SUCCESS)
error ("Could not select thread %d causing exception", mid); error ("Could not select thread %d causing exception", mid);
else else
message ("Gdb selected thread %d", mid); warning ("Gdb selected thread %d", mid);
} }
/* If we receive an exception that is not breakpoint /* If we receive an exception that is not breakpoint
@ -1656,7 +1700,7 @@ catch_exception_raise (port, thread, task, exception, code, subcode)
if (MACH_PORT_VALID (singlestepped_thread_port)) if (MACH_PORT_VALID (singlestepped_thread_port))
{ {
if (stop_exception != EXC_BREAKPOINT) if (stop_exception != EXC_BREAKPOINT)
message ("Single step interrupted by exception"); warning ("Single step interrupted by exception");
else if (port == singlestepped_thread_port) else if (port == singlestepped_thread_port)
{ {
/* Single step exception occurred, remove trace bit /* Single step exception occurred, remove trace bit
@ -1669,7 +1713,7 @@ catch_exception_raise (port, thread, task, exception, code, subcode)
resume_all_threads (0); resume_all_threads (0);
} }
else else
message ("Breakpoint while single stepping?"); warning ("Breakpoint while single stepping?");
discard_single_step (current_thread); discard_single_step (current_thread);
} }
@ -1746,7 +1790,7 @@ mach3_read_inferior (addr, myaddr, length)
screw it. Eamonn seems to like this, so I enable screw it. Eamonn seems to like this, so I enable
it if OSF is defined... it if OSF is defined...
*/ */
message ("[read inferior %x failed: %s]", warning ("[read inferior %x failed: %s]",
addr, mach_error_string (ret)); addr, mach_error_string (ret));
errno = 0; errno = 0;
#endif #endif
@ -1852,7 +1896,7 @@ mach3_write_inferior (addr, myaddr, length)
/* Check for holes in memory */ /* Check for holes in memory */
if (old_address != region_address) if (old_address != region_address)
{ {
message ("No memory at 0x%x. Nothing written", warning ("No memory at 0x%x. Nothing written",
old_address); old_address);
ret = KERN_SUCCESS; ret = KERN_SUCCESS;
length = 0; length = 0;
@ -1861,7 +1905,7 @@ mach3_write_inferior (addr, myaddr, length)
if (!(max_protection & VM_PROT_WRITE)) if (!(max_protection & VM_PROT_WRITE))
{ {
message ("Memory at address 0x%x is unwritable. Nothing written", warning ("Memory at address 0x%x is unwritable. Nothing written",
old_address); old_address);
ret = KERN_SUCCESS; ret = KERN_SUCCESS;
length = 0; length = 0;
@ -1940,7 +1984,7 @@ mach3_write_inferior (addr, myaddr, length)
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("%s %s", errstr, mach_error_string (ret)); warning ("%s %s", errstr, mach_error_string (ret));
return 0; return 0;
} }
@ -1982,22 +2026,21 @@ int state;
} }
static char * static char *
translate_cstate(state) translate_cstate (state)
int state; int state;
{ {
switch (state) { switch (state)
case CPROC_RUNNING: return "R"; {
case CPROC_SWITCHING: return "S"; case CPROC_RUNNING: return "R";
case CPROC_BLOCKED: return "B"; case CPROC_SWITCHING: return "S";
case CPROC_CONDWAIT: return "C"; case CPROC_BLOCKED: return "B";
case CPROC_CONDWAIT|CPROC_SWITCHING: case CPROC_CONDWAIT: return "C";
return "CS"; case CPROC_CONDWAIT|CPROC_SWITCHING: return "CS";
default: return "?"; default: return "?";
} }
} }
/* type == MACH_MSG_TYPE_COPY_SEND || type == MACH_MSG_TYPE_MAKE_SEND /* type == MACH_MSG_TYPE_COPY_SEND || type == MACH_MSG_TYPE_MAKE_SEND */
*/
mach_port_t /* no mach_port_name_t found in include files. */ mach_port_t /* no mach_port_name_t found in include files. */
map_inferior_port_name (inferior_name, type) map_inferior_port_name (inferior_name, type)
@ -2041,26 +2084,26 @@ static char buf[7];
static char * static char *
get_thread_name (one_cproc, id) get_thread_name (one_cproc, id)
cproc_t one_cproc; gdb_thread_t one_cproc;
int id; int id;
{ {
if (one_cproc) if (one_cproc)
if (one_cproc->incarnation == NULL) if (one_cproc->cthread == NULL)
{ {
/* cproc not mapped to any cthread */ /* cproc not mapped to any cthread */
sprintf(buf, "_C%d", id); sprintf(buf, "_C%d", id);
} }
else if (! one_cproc->incarnation->name) else if (! one_cproc->cthread->name)
{ {
/* cproc and cthread, but no name */ /* cproc and cthread, but no name */
sprintf(buf, "_t%d", id); sprintf(buf, "_t%d", id);
} }
else else
return (one_cproc->incarnation->name); return (one_cproc->cthread->name);
else else
{ {
if (id < 0) if (id < 0)
message ("Inconsistency in thread name id %d", id); warning ("Inconsistency in thread name id %d", id);
/* Kernel thread without cproc */ /* Kernel thread without cproc */
sprintf(buf, "_K%d", id); sprintf(buf, "_K%d", id);
@ -2083,7 +2126,7 @@ fetch_thread_info (task, mthreads_out)
ret = task_threads (task, &th_table, &th_count); ret = task_threads (task, &th_table, &th_count);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Error getting inferior's thread list:%s", warning ("Error getting inferior's thread list:%s",
mach_error_string(ret)); mach_error_string(ret));
kill_inferior (); kill_inferior ();
return -1; return -1;
@ -2130,7 +2173,7 @@ fetch_thread_info (task, mthreads_out)
(th_count * sizeof(mach_port_t))); (th_count * sizeof(mach_port_t)));
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Error trying to deallocate thread list : %s", warning ("Error trying to deallocate thread list : %s",
mach_error_string (ret)); mach_error_string (ret));
} }
@ -2157,7 +2200,7 @@ fetch_usp_from_emulator_stack (sp)
&stack_pointer, &stack_pointer,
sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) sizeof (CORE_ADDR)) != sizeof (CORE_ADDR))
{ {
message ("Can't read user sp from emulator stack address 0x%x", sp); warning ("Can't read user sp from emulator stack address 0x%x", sp);
return 0; return 0;
} }
@ -2211,7 +2254,7 @@ have_emulator_p (task)
static boolean_t informed = FALSE; static boolean_t informed = FALSE;
if (!informed) if (!informed)
{ {
message("Emulation vector address 0x08%x outside emulator space", warning("Emulation vector address 0x08%x outside emulator space",
entry); entry);
informed = TRUE; informed = TRUE;
} }
@ -2220,41 +2263,41 @@ have_emulator_p (task)
return FALSE; return FALSE;
} }
/* /* Map cprocs to kernel threads and vice versa. */
* Map cprocs to kernel threads and vice versa.
*
* For reverse mapping the code mis-uses one struct cproc field,
* see "os-mach3.h" and code here.
*
*/
void void
map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count) map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count)
cproc_t cprocs; gdb_thread_t cprocs;
gdb_thread_t mthreads; gdb_thread_t mthreads;
int thread_count; int thread_count;
{ {
int index; int index;
cproc_t scan; gdb_thread_t scan;
boolean_t all_mapped = TRUE; boolean_t all_mapped = TRUE;
for (scan = cprocs; scan; scan = scan->list) for (scan = cprocs; scan; scan = scan->next)
{ {
/* Default to: no kernel thread for this cproc */ /* Default to: no kernel thread for this cproc */
CPROC_REVERSE_MAP (scan) = -1; scan->reverse_map = -1;
/* Check if the cproc is found by its stack */ /* Check if the cproc is found by its stack */
for (index = 0; index < thread_count; index++) for (index = 0; index < thread_count; index++)
{ {
if ((mthreads + index)->sp > scan->stack_base && LONGEST stack_base =
(mthreads + index)->sp <= scan->stack_base + scan->stack_size) extract_signed_integer (scan.raw_cproc + CPROC_BASE_OFFSET,
CPROC_BASE_SIZE);
LONGEST stack_size =
extract_signed_integer (scan.raw_cproc + CPROC_SIZE_OFFSET,
CPROC_SIZE_SIZE);
if ((mthreads + index)->sp > stack_base &&
(mthreads + index)->sp <= stack_base + stack_size)
{ {
(mthreads + index)->cproc = scan; (mthreads + index)->cproc = scan;
CPROC_REVERSE_MAP (scan) = index; scan->reverse_map = index;
break; break;
} }
} }
all_mapped &= (CPROC_REVERSE_MAP(scan) != -1); all_mapped &= (scan->reverse_map != -1);
} }
/* Check for threads that are currently in the emulator. /* Check for threads that are currently in the emulator.
@ -2282,7 +2325,7 @@ map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count)
gdb_thread_t mthread = (mthreads+index); gdb_thread_t mthread = (mthreads+index);
emul_sp = mthread->sp; emul_sp = mthread->sp;
if (! mthread->cproc && if (mthread->cproc == NULL &&
EMULATOR_BASE <= emul_sp && emul_sp <= EMULATOR_END) EMULATOR_BASE <= emul_sp && emul_sp <= EMULATOR_END)
{ {
mthread->in_emulator = emulator_present; mthread->in_emulator = emulator_present;
@ -2298,19 +2341,19 @@ map_cprocs_to_kernel_threads (cprocs, mthreads, thread_count)
/* Try to match this stack pointer to the cprocs that /* Try to match this stack pointer to the cprocs that
* don't yet have a kernel thread. * don't yet have a kernel thread.
*/ */
for (scan = cprocs; scan; scan = scan->list) for (scan = cprocs; scan; scan = scan->next)
{ {
/* Check is this unmapped CPROC stack contains /* Check is this unmapped CPROC stack contains
* the user stack pointer saved in the * the user stack pointer saved in the
* emulator. * emulator.
*/ */
if (CPROC_REVERSE_MAP (scan) == -1 && if (scan->reverse_map == -1 &&
usp > scan->stack_base && usp > scan->stack_base &&
usp <= scan->stack_base + scan->stack_size) usp <= scan->stack_base + scan->stack_size)
{ {
mthread->cproc = scan; mthread->cproc = scan;
CPROC_REVERSE_MAP (scan) = index; scan->reverse_map = index;
break; break;
} }
} }
@ -2380,10 +2423,13 @@ lookup_address_of_variable (name)
return symaddr; return symaddr;
} }
static cproc_t static gdb_thread_t
get_cprocs() get_cprocs()
{ {
cproc_t their_cprocs, cproc_head, cproc_copy; gdb_thread_t cproc_head;
gdb_thread_t cproc_copy;
CORE_ADDR their_cprocs;
char *buf[TARGET_PTR_BIT / HOST_CHAR_BIT];
char *name; char *name;
cthread_t cthread; cthread_t cthread;
CORE_ADDR symaddr; CORE_ADDR symaddr;
@ -2391,7 +2437,8 @@ get_cprocs()
symaddr = lookup_address_of_variable ("cproc_list"); symaddr = lookup_address_of_variable ("cproc_list");
if (! symaddr) if (! symaddr)
{ /* cproc_list is not in a file compiled with debugging {
/* cproc_list is not in a file compiled with debugging
symbols, but don't give up yet */ symbols, but don't give up yet */
symaddr = lookup_address_of_variable ("cprocs"); symaddr = lookup_address_of_variable ("cprocs");
@ -2399,56 +2446,67 @@ get_cprocs()
if (symaddr) if (symaddr)
{ {
static int informed = 0; static int informed = 0;
if (!informed) { if (!informed)
informed++; {
message ("Your program is loaded with an old threads library."); informed++;
message ("GDB does not know the old form of threads"); warning ("Your program is loaded with an old threads library.");
message ("so things may not work."); warning ("GDB does not know the old form of threads");
} warning ("so things may not work.");
}
} }
} }
/* Stripped or no -lthreads loaded or "cproc_list" is in wrong segment. */ /* Stripped or no -lthreads loaded or "cproc_list" is in wrong segment. */
if (! symaddr) if (! symaddr)
return NO_CPROC; return NULL;
/* Get the address of the first cproc in the task */ /* Get the address of the first cproc in the task */
if (!mach3_read_inferior(symaddr, if (!mach3_read_inferior (symaddr,
&their_cprocs, buf,
sizeof(cproc_t))) TARGET_PTR_BIT / HOST_CHAR_BIT))
error("Can't read cproc master list at address (0x%x).", symaddr); error ("Can't read cproc master list at address (0x%x).", symaddr);
their_cprocs = extract_address (buf, TARGET_PTR_BIT / HOST_CHAR_BIT);
/* Scan the CPROCs in the task. /* Scan the CPROCs in the task.
CPROCs are chained with LIST field, not NEXT field, which CPROCs are chained with LIST field, not NEXT field, which
chains mutexes, condition variables and queues */ chains mutexes, condition variables and queues */
cproc_head = NO_CPROC; cproc_head = NULL;
while (their_cprocs != NO_CPROC) while (their_cprocs != (CORE_ADDR)0)
{ {
cproc_copy = (cproc_t) obstack_alloc(cproc_obstack, CORE_ADDR cproc_copy_incarnation;
sizeof(struct cproc)); cproc_copy = (gdb_thread_t) obstack_alloc (cproc_obstack,
sizeof (struct gdb_thread));
if (!mach3_read_inferior(their_cprocs, if (!mach3_read_inferior (their_cprocs,
cproc_copy, &cproc_copy.raw_cproc[0],
sizeof(struct cproc))) CPROC_SIZE))
error("Can't read next cproc at 0x%x.", their_cprocs); error("Can't read next cproc at 0x%x.", their_cprocs);
cproc_copy = extract_address (buf, TARGET_PTR_BIT / HOST_CHAR_BIT);
their_cprocs = cproc_copy->list; their_cprocs =
extract_address (cproc_copy.raw_cproc + CPROC_LIST_OFFSET,
CPROC_LIST_SIZE);
cproc_copy_incarnation =
extract_address (cproc_copy.raw_cproc + CPROC_INCARNATION_OFFSET,
CPROC_INCARNATION_SIZE);
if (cproc_copy->incarnation != NULL) if (cproc_copy_incarnation == (CORE_ADDR)0)
cproc_copy->cthread = NULL;
else
{ {
/* This CPROC has an attached CTHREAD. Get its name */ /* This CPROC has an attached CTHREAD. Get its name */
cthread = (cthread_t)obstack_alloc (cproc_obstack, cthread = (cthread_t)obstack_alloc (cproc_obstack,
sizeof(struct cthread)); sizeof(struct cthread));
if (!mach3_read_inferior(cproc_copy->incarnation, if (!mach3_read_inferior (cproc_copy_incarnation,
cthread, cthread,
sizeof(struct cthread))) sizeof(struct cthread)))
error("Can't read next thread at 0x%x.", error("Can't read next thread at 0x%x.",
cproc_copy->incarnation); cproc_copy_incarnation);
cproc_copy->incarnation = cthread; cproc_copy->cthread = cthread;
if (cthread->name) if (cthread->name)
{ {
@ -2462,10 +2520,10 @@ get_cprocs()
} }
/* insert in front */ /* insert in front */
cproc_copy->list = cproc_head; cproc_copy->next = cproc_head;
cproc_head = cproc_copy; cproc_head = cproc_copy;
} }
return(cproc_head); return cproc_head;
} }
#ifndef FETCH_CPROC_STATE #ifndef FETCH_CPROC_STATE
@ -2489,7 +2547,9 @@ mach3_cproc_state (mthread)
if (! mthread || !mthread->cproc || !mthread->cproc->context) if (! mthread || !mthread->cproc || !mthread->cproc->context)
return -1; return -1;
context = mthread->cproc->context; context = extract_signed_integer
(mthread->cproc->raw_cproc + CPROC_CONTEXT_OFFSET,
CPROC_CONTEXT_SIZE);
mthread->sp = context + MACHINE_CPROC_SP_OFFSET; mthread->sp = context + MACHINE_CPROC_SP_OFFSET;
@ -2497,7 +2557,7 @@ mach3_cproc_state (mthread)
&mthread->pc, &mthread->pc,
sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) sizeof (CORE_ADDR)) != sizeof (CORE_ADDR))
{ {
message ("Can't read cproc pc from inferior"); warning ("Can't read cproc pc from inferior");
return -1; return -1;
} }
@ -2505,7 +2565,7 @@ mach3_cproc_state (mthread)
&mthread->fp, &mthread->fp,
sizeof (CORE_ADDR)) != sizeof (CORE_ADDR)) sizeof (CORE_ADDR)) != sizeof (CORE_ADDR))
{ {
message ("Can't read cproc fp from inferior"); warning ("Can't read cproc fp from inferior");
return -1; return -1;
} }
@ -2519,8 +2579,8 @@ thread_list_command()
{ {
thread_basic_info_data_t ths; thread_basic_info_data_t ths;
int thread_count; int thread_count;
cproc_t cprocs; gdb_thread_t cprocs;
cproc_t scan; gdb_thread_t scan;
int index; int index;
char *name; char *name;
char selected; char selected;
@ -2555,7 +2615,7 @@ thread_list_command()
map_cprocs_to_kernel_threads (cprocs, their_threads, thread_count); map_cprocs_to_kernel_threads (cprocs, their_threads, thread_count);
for (scan = cprocs; scan; scan = scan->list) for (scan = cprocs; scan; scan = scan->next)
{ {
int mid; int mid;
char buf[10]; char buf[10];
@ -2564,10 +2624,12 @@ thread_list_command()
selected = ' '; selected = ' ';
/* a wired cproc? */ /* a wired cproc? */
wired = scan->wired ? "wired" : ""; wired = (extract_address (scan->raw_cproc + CPROC_WIRED_OFFSET,
CPROC_WIRED_SIZE)
? "wired" : "");
if (CPROC_REVERSE_MAP(scan) != -1) if (scan->reverse_map != -1)
kthread = (their_threads + CPROC_REVERSE_MAP(scan)); kthread = (their_threads + scan->reverse_map);
else else
kthread = NULL; kthread = NULL;
@ -2586,7 +2648,7 @@ thread_list_command()
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Unable to get basic info on thread %d : %s", warning ("Unable to get basic info on thread %d : %s",
mid, mid,
mach_error_string (ret)); mach_error_string (ret));
continue; continue;
@ -2611,6 +2673,7 @@ thread_list_command()
if (ths.flags & TH_FLAGS_IDLE) if (ths.flags & TH_FLAGS_IDLE)
strcat (buf, "I"); strcat (buf, "I");
/* FIXME: May run afloul of arbitrary limit in printf_filtered. */
printf_filtered (TL_FORMAT, printf_filtered (TL_FORMAT,
slot, slot,
mid, mid,
@ -2638,6 +2701,7 @@ thread_list_command()
continue; /* EMcM */ continue; /* EMcM */
#endif #endif
/* FIXME: May run afloul of arbitrary limit in printf_filtered. */
printf_filtered (TL_FORMAT, printf_filtered (TL_FORMAT,
"-", "-",
-neworder, /* Pseudo MID */ -neworder, /* Pseudo MID */
@ -2683,7 +2747,7 @@ thread_list_command()
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Unable to get basic info on thread %d : %s", warning ("Unable to get basic info on thread %d : %s",
mid, mid,
mach_error_string (ret)); mach_error_string (ret));
continue; continue;
@ -2709,6 +2773,7 @@ thread_list_command()
if (ths.flags & TH_FLAGS_IDLE) if (ths.flags & TH_FLAGS_IDLE)
strcat (buf, "I"); strcat (buf, "I");
/* FIXME: May run afloul of arbitrary limit in printf_filtered. */
printf_filtered (TL_FORMAT, printf_filtered (TL_FORMAT,
slot, slot,
mid, mid,
@ -2779,7 +2844,7 @@ boolean_t set;
if (! MACH_PORT_VALID (thread)) if (! MACH_PORT_VALID (thread))
{ {
message ("thread_trace: invalid thread"); warning ("thread_trace: invalid thread");
return; return;
} }
@ -2828,7 +2893,7 @@ flush_inferior_icache(pc, amount)
MATTR_CACHE, MATTR_CACHE,
&flush); &flush);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("Error flushing inferior's cache : %s", warning ("Error flushing inferior's cache : %s",
mach_error_string (ret)); mach_error_string (ret));
} }
#endif FLUSH_INFERIOR_CACHE #endif FLUSH_INFERIOR_CACHE
@ -2848,7 +2913,7 @@ suspend_all_threads (from_tty)
ret = task_threads (inferior_task, &thread_list, &thread_count); ret = task_threads (inferior_task, &thread_list, &thread_count);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("Could not suspend inferior threads."); warning ("Could not suspend inferior threads.");
kill_inferior (); kill_inferior ();
return_to_top_level (); return_to_top_level ();
} }
@ -2863,7 +2928,7 @@ suspend_all_threads (from_tty)
ret = thread_suspend(thread_list[ index ]); ret = thread_suspend(thread_list[ index ]);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("Error trying to suspend thread %d : %s", warning ("Error trying to suspend thread %d : %s",
mid, mach_error_string (ret)); mid, mach_error_string (ret));
if (from_tty) if (from_tty)
@ -2875,7 +2940,7 @@ suspend_all_threads (from_tty)
&infoCnt); &infoCnt);
CHK ("suspend can't get thread info", ret); CHK ("suspend can't get thread info", ret);
message ("Thread %d suspend count is %d", warning ("Thread %d suspend count is %d",
mid, th_info.suspend_count); mid, th_info.suspend_count);
} }
} }
@ -2924,7 +2989,7 @@ thread_suspend_command (args, from_tty)
ret = thread_suspend (current_thread); ret = thread_suspend (current_thread);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("thread_suspend failed : %s", warning ("thread_suspend failed : %s",
mach_error_string (ret)); mach_error_string (ret));
infoCnt = THREAD_BASIC_INFO_COUNT; infoCnt = THREAD_BASIC_INFO_COUNT;
@ -2934,7 +2999,7 @@ thread_suspend_command (args, from_tty)
&infoCnt); &infoCnt);
CHK ("suspend can't get thread info", ret); CHK ("suspend can't get thread info", ret);
message ("Thread %d suspend count is %d", mid, th_info.suspend_count); warning ("Thread %d suspend count is %d", mid, th_info.suspend_count);
current_thread = saved_thread; current_thread = saved_thread;
} }
@ -2971,17 +3036,17 @@ resume_all_threads (from_tty)
if (! th_info.suspend_count) if (! th_info.suspend_count)
{ {
if (mid != -1 && from_tty) if (mid != -1 && from_tty)
message ("Thread %d is not suspended", mid); warning ("Thread %d is not suspended", mid);
continue; continue;
} }
ret = thread_resume (thread_list[ index ]); ret = thread_resume (thread_list[ index ]);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("Error trying to resume thread %d : %s", warning ("Error trying to resume thread %d : %s",
mid, mach_error_string (ret)); mid, mach_error_string (ret));
else if (mid != -1 && from_tty) else if (mid != -1 && from_tty)
message ("Thread %d suspend count is %d", warning ("Thread %d suspend count is %d",
mid, --th_info.suspend_count); mid, --th_info.suspend_count);
} }
@ -3035,18 +3100,18 @@ thread_resume_command (args, from_tty)
if (! th_info.suspend_count) if (! th_info.suspend_count)
{ {
message ("Thread %d is not suspended", mid); warning ("Thread %d is not suspended", mid);
goto out; goto out;
} }
ret = thread_resume (current_thread); ret = thread_resume (current_thread);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("thread_resume failed : %s", warning ("thread_resume failed : %s",
mach_error_string (ret)); mach_error_string (ret));
else else
{ {
th_info.suspend_count--; th_info.suspend_count--;
message ("Thread %d suspend count is %d", mid, th_info.suspend_count); warning ("Thread %d suspend count is %d", mid, th_info.suspend_count);
} }
out: out:
@ -3094,7 +3159,7 @@ thread_kill_command (args, from_tty)
CHK ("Thread could not be terminated", ret); CHK ("Thread could not be terminated", ret);
if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS) if (select_thread (inferior_task, 0, 1) != KERN_SUCCESS)
message ("Last thread was killed, use \"kill\" command to kill task"); warning ("Last thread was killed, use \"kill\" command to kill task");
} }
else else
for (index = 0; index < thread_count; index++) for (index = 0; index < thread_count; index++)
@ -3111,7 +3176,7 @@ thread_kill_command (args, from_tty)
(thread_count * sizeof(mach_port_t))); (thread_count * sizeof(mach_port_t)));
CHK ("Error trying to deallocate thread list", ret); CHK ("Error trying to deallocate thread list", ret);
message ("Thread %d killed", mid); warning ("Thread %d killed", mid);
} }
@ -3151,14 +3216,14 @@ task_resume_command (args, from_tty)
if (ta_info.suspend_count == 1) if (ta_info.suspend_count == 1)
{ {
message ("Inferior task %d is no longer suspended", mid); warning ("Inferior task %d is no longer suspended", mid);
must_suspend_thread = 1; must_suspend_thread = 1;
/* @@ This is not complete: Registers change all the time when not /* @@ This is not complete: Registers change all the time when not
suspended! */ suspended! */
registers_changed (); registers_changed ();
} }
else else
message ("Inferior task %d suspend count is now %d", warning ("Inferior task %d suspend count is now %d",
mid, ta_info.suspend_count-1); mid, ta_info.suspend_count-1);
} }
@ -3190,7 +3255,7 @@ task_suspend_command (args, from_tty)
&infoCnt); &infoCnt);
CHK ("task_suspend_command: task_info failed", ret); CHK ("task_suspend_command: task_info failed", ret);
message ("Inferior task %d suspend count is now %d", warning ("Inferior task %d suspend count is now %d",
mid, ta_info.suspend_count); mid, ta_info.suspend_count);
} }
@ -3507,7 +3572,7 @@ gdb_register_port (name, port)
if (! MACH_PORT_VALID (port) || !name || !*name) if (! MACH_PORT_VALID (port) || !name || !*name)
{ {
message ("Invalid registration request"); warning ("Invalid registration request");
return; return;
} }
@ -3665,29 +3730,31 @@ do_mach_notify_dead_name (notify, name)
switch (element->type) { switch (element->type) {
case MACH_TYPE_THREAD: case MACH_TYPE_THREAD:
target_terminal_ours_for_output ();
if (name == current_thread) if (name == current_thread)
{ {
message ("\nCurrent thread %d died", element->mid); printf_filtered ("\nCurrent thread %d died", element->mid);
current_thread = MACH_PORT_NULL; current_thread = MACH_PORT_NULL;
} }
else else
message ("\nThread %d died", element->mid); printf_filtered ("\nThread %d died", element->mid);
break; break;
case MACH_TYPE_TASK: case MACH_TYPE_TASK:
target_terminal_ours_for_output ();
if (name != inferior_task) if (name != inferior_task)
message ("Task %d died, but it was not the selected task", printf_filtered ("Task %d died, but it was not the selected task",
element->mid); element->mid);
else else
{ {
message ("Current task %d died", element->mid); printf_filtered ("Current task %d died", element->mid);
mach_port_destroy (mach_task_self(), name); mach_port_destroy (mach_task_self(), name);
inferior_task = MACH_PORT_NULL; inferior_task = MACH_PORT_NULL;
if (notify_chain) if (notify_chain)
message("There were still unreceived dead_name_notifications???"); warning ("There were still unreceived dead_name_notifications???");
/* Destroy the old notifications */ /* Destroy the old notifications */
setup_notify_port (0); setup_notify_port (0);
@ -3709,7 +3776,7 @@ do_mach_notify_msg_accepted (notify, name)
mach_port_t notify; mach_port_t notify;
mach_port_t name; mach_port_t name;
{ {
message ("do_mach_notify_msg_accepted : notify %x, name %x", warning ("do_mach_notify_msg_accepted : notify %x, name %x",
notify, name); notify, name);
return KERN_SUCCESS; return KERN_SUCCESS;
} }
@ -3719,7 +3786,7 @@ do_mach_notify_no_senders (notify, mscount)
mach_port_t notify; mach_port_t notify;
mach_port_mscount_t mscount; mach_port_mscount_t mscount;
{ {
message ("do_mach_notify_no_senders : notify %x, mscount %x", warning ("do_mach_notify_no_senders : notify %x, mscount %x",
notify, mscount); notify, mscount);
return KERN_SUCCESS; return KERN_SUCCESS;
} }
@ -3729,7 +3796,7 @@ do_mach_notify_port_deleted (notify, name)
mach_port_t notify; mach_port_t notify;
mach_port_t name; mach_port_t name;
{ {
message ("do_mach_notify_port_deleted : notify %x, name %x", warning ("do_mach_notify_port_deleted : notify %x, name %x",
notify, name); notify, name);
return KERN_SUCCESS; return KERN_SUCCESS;
} }
@ -3739,7 +3806,7 @@ do_mach_notify_port_destroyed (notify, rights)
mach_port_t notify; mach_port_t notify;
mach_port_t rights; mach_port_t rights;
{ {
message ("do_mach_notify_port_destroyed : notify %x, rights %x", warning ("do_mach_notify_port_destroyed : notify %x, rights %x",
notify, rights); notify, rights);
return KERN_SUCCESS; return KERN_SUCCESS;
} }
@ -3750,7 +3817,7 @@ do_mach_notify_send_once (notify)
{ {
#ifdef DUMP_SYSCALL #ifdef DUMP_SYSCALL
/* MANY of these are generated. */ /* MANY of these are generated. */
message ("do_mach_notify_send_once : notify %x", warning ("do_mach_notify_send_once : notify %x",
notify); notify);
#endif #endif
return KERN_SUCCESS; return KERN_SUCCESS;
@ -3882,7 +3949,7 @@ m3_resume (pid, step, signal)
ret = task_resume (inferior_task); ret = task_resume (inferior_task);
if (ret == KERN_FAILURE) if (ret == KERN_FAILURE)
message ("Task was not suspended"); warning ("Task was not suspended");
else else
CHK ("Resuming task", ret); CHK ("Resuming task", ret);
@ -4037,7 +4104,7 @@ deallocate_inferior_ports ()
ret = task_threads (inferior_task, &thread_list, &thread_count); ret = task_threads (inferior_task, &thread_list, &thread_count);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
{ {
message ("deallocate_inferior_ports: task_threads", warning ("deallocate_inferior_ports: task_threads",
mach_error_string(ret)); mach_error_string(ret));
return; return;
} }
@ -4107,7 +4174,7 @@ m3_do_detach (signal)
setup_notify_port (0); setup_notify_port (0);
if (remove_breakpoints ()) if (remove_breakpoints ())
message ("Could not remove breakpoints when detaching"); warning ("Could not remove breakpoints when detaching");
if (signal && inferior_pid > 0) if (signal && inferior_pid > 0)
kill (inferior_pid, signal); kill (inferior_pid, signal);
@ -4435,9 +4502,9 @@ _initialize_m3_nat ()
{ {
mid_server = MACH_PORT_NULL; mid_server = MACH_PORT_NULL;
message ("initialize machid: netname_lookup_up(MachID) : %s", warning ("initialize machid: netname_lookup_up(MachID) : %s",
mach_error_string(ret)); mach_error_string(ret));
message ("Some (most?) features disabled..."); warning ("Some (most?) features disabled...");
} }
mid_auth = mach_privileged_host_port(); mid_auth = mach_privileged_host_port();
@ -4462,7 +4529,7 @@ _initialize_m3_nat ()
MACH_PORT_RIGHT_RECEIVE, MACH_PORT_RIGHT_RECEIVE,
&our_message_port); &our_message_port);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("Creating message port %s", mach_error_string (ret)); warning ("Creating message port %s", mach_error_string (ret));
else else
{ {
char buf[ MAX_NAME_LEN ]; char buf[ MAX_NAME_LEN ];
@ -4470,7 +4537,7 @@ _initialize_m3_nat ()
our_message_port, our_message_port,
inferior_wait_port_set); inferior_wait_port_set);
if (ret != KERN_SUCCESS) if (ret != KERN_SUCCESS)
message ("message move member %s", mach_error_string (ret)); warning ("message move member %s", mach_error_string (ret));
/* @@@@ No way to change message port name currently */ /* @@@@ No way to change message port name currently */

View File

@ -252,10 +252,6 @@ eb_create_inferior (execfile, args, env)
entry_pt = (int) bfd_get_start_address (exec_bfd); entry_pt = (int) bfd_get_start_address (exec_bfd);
#ifdef CREATE_INFERIOR_HOOK
CREATE_INFERIOR_HOOK (0); /* No process-ID */
#endif
{ {
/* OK, now read in the file. Y=read, C=COFF, D=no symbols /* OK, now read in the file. Y=read, C=COFF, D=no symbols
0=start address, %s=filename. */ 0=start address, %s=filename. */

View File

@ -76,6 +76,7 @@ static int sr_get_debug(); /* flag set by "set remotedebug" */
#endif #endif
static int hashmark; /* flag set by "set hash" */ static int hashmark; /* flag set by "set hash" */
/* FIXME: Replace with sr_get_debug (). */
#define LOG_FILE "monitor.log" #define LOG_FILE "monitor.log"
#if defined (LOG_FILE) #if defined (LOG_FILE)
FILE *log_file; FILE *log_file;
@ -288,9 +289,6 @@ monitor_create_inferior (execfile, args, env)
entry_pt = (int) bfd_get_start_address (exec_bfd); entry_pt = (int) bfd_get_start_address (exec_bfd);
#ifdef CREATE_INFERIOR_HOOK
CREATE_INFERIOR_HOOK (0); /* No process-ID */
#endif
#ifdef LOG_FILE #ifdef LOG_FILE
fputs ("\nIn Create_inferior()", log_file); fputs ("\nIn Create_inferior()", log_file);
#endif #endif

View File

@ -609,12 +609,8 @@ nindy_create_inferior (execfile, args, env)
pid = 42; pid = 42;
#ifdef CREATE_INFERIOR_HOOK /* The "process" (board) is already stopped awaiting our commands, and
CREATE_INFERIOR_HOOK (pid); the program is already downloaded. We just set its PC and go. */
#endif
/* The "process" (board) is already stopped awaiting our commands, and
the program is already downloaded. We just set its PC and go. */
inferior_pid = pid; /* Needed for wait_for_inferior below */ inferior_pid = pid; /* Needed for wait_for_inferior below */

View File

@ -251,10 +251,6 @@ st2000_create_inferior (execfile, args, env)
entry_pt = (int) bfd_get_start_address (exec_bfd); entry_pt = (int) bfd_get_start_address (exec_bfd);
#ifdef CREATE_INFERIOR_HOOK
CREATE_INFERIOR_HOOK (0); /* No process-ID */
#endif
/* The "process" (board) is already stopped awaiting our commands, and /* The "process" (board) is already stopped awaiting our commands, and
the program is already downloaded. We just set its PC and go. */ the program is already downloaded. We just set its PC and go. */

View File

@ -215,10 +215,6 @@ vx_create_inferior (exec_file, args, env)
vx_running = savestring (passArgs.arg_array_val[0], vx_running = savestring (passArgs.arg_array_val[0],
strlen (passArgs.arg_array_val[0])); strlen (passArgs.arg_array_val[0]));
#ifdef CREATE_INFERIOR_HOOK
CREATE_INFERIOR_HOOK (pid);
#endif
push_target (&vx_run_ops); push_target (&vx_run_ops);
inferior_pid = taskStart.pid; inferior_pid = taskStart.pid;