Johns release

This commit is contained in:
K. Richard Pixley
1991-03-28 16:28:29 +00:00
parent bd5635a1e2
commit dd3b648e8b
246 changed files with 59132 additions and 0 deletions

28
gdb/vx-share/dbgRpcLib.h Normal file
View File

@ -0,0 +1,28 @@
/* dbgRpcLib.h - header file for remote debugging via rpc */
/*
modification history
--------------------
01b,04oct90,maf added VX_BOOT_FILE_INQ.
01a,05jun90,llk extracted from xdr_dbx.h.
*/
#ifndef INCdbxRpcLibh
#define INCdbxRpcLibh 1
#define PROCESS_START 50
#define PROCESS_WAIT 51
#define VX_STATE_INQ 60
#define VX_LOAD 61
#define VX_SYMBOL_INQ 62
#define VX_BREAK_ADD 63
#define VX_BREAK_DELETE 64
#define VX_FP_INQUIRE 65
#define VX_TASK_SUSPEND 66
#define VX_CALL_FUNC 67
#define VX_CONV_FROM_68881 68
#define VX_CONV_TO_68881 69
#define VX_BOOT_FILE_INQ 70
#define VX_SOURCE_STEP 71
#endif INCdbxRpcLibh

44
gdb/vx-share/ptrace.h Normal file
View File

@ -0,0 +1,44 @@
/* @(#)ptrace.h 1.1 86/07/07 SMI */
/*
* Copyright (c) 1985 by Sun Microsystems, Inc.
*/
/*
modification history
--------------------
01a,05jun90,llk borrowed.
*/
#ifndef _PTRACE_
#define _PTRACE_
/*
* Request values for the ptrace system call
*/
enum ptracereq {
PTRACE_TRACEME = 0, /* 0, by tracee to begin tracing */
PTRACE_CHILDDONE = 0, /* 0, tracee is done with his half */
PTRACE_PEEKTEXT, /* 1, read word from text segment */
PTRACE_PEEKDATA, /* 2, read word from data segment */
PTRACE_PEEKUSER, /* 3, read word from user struct */
PTRACE_POKETEXT, /* 4, write word into text segment */
PTRACE_POKEDATA, /* 5, write word into data segment */
PTRACE_POKEUSER, /* 6, write word into user struct */
PTRACE_CONT, /* 7, continue process */
PTRACE_KILL, /* 8, terminate process */
PTRACE_SINGLESTEP, /* 9, single step process */
PTRACE_ATTACH, /* 10, attach to an existing process */
PTRACE_DETACH, /* 11, detach from a process */
PTRACE_GETREGS, /* 12, get all registers */
PTRACE_SETREGS, /* 13, set all registers */
PTRACE_GETFPREGS, /* 14, get all floating point regs */
PTRACE_SETFPREGS, /* 15, set all floating point regs */
PTRACE_READDATA, /* 16, read data segment */
PTRACE_WRITEDATA, /* 17, write data segment */
PTRACE_READTEXT, /* 18, read text segment */
PTRACE_WRITETEXT, /* 19, write text segment */
PTRACE_GETFPAREGS, /* 20, get all fpa regs */
PTRACE_SETFPAREGS, /* 21, set all fpa regs */
};
#endif !_PTRACE

209
gdb/vx-share/reg.h Normal file
View File

@ -0,0 +1,209 @@
/* @(#)reg.h 1.1 86/07/07 SMI */
/*
* Copyright (c) 1986 by Sun Microsystems, Inc.
*/
/*
modification history
--------------------
01a,05jun90,llk borrowed.
*/
#ifndef _REG_
#define _REG_
#ifdef I80960
/* Intel 960 register values passed over the wire by RPC: */
struct regs
{
int r_lreg[16]; /* local registers */
int r_greg[16]; /* global registers */
int r_pcw; /* process control word */
int r_acw; /* arithmetic control word */
int r_tcw; /* trace control word */
};
#define FP_REG_SIZE 12
struct fp_status {
char fps_regs[4][FP_REG_SIZE]; /* floating point regs */
};
#else /* For now, just 68000 */
/*
* Location of the users' stored
* registers relative to R0.
* Usage is u.u_ar0[XX].
*/
#define R0 (0)
#define R1 (1)
#define R2 (2)
#define R3 (3)
#define R4 (4)
#define R5 (5)
#define R6 (6)
#define R7 (7)
#define AR0 (8)
#define AR1 (9)
#define AR2 (10)
#define AR3 (11)
#define AR4 (12)
#define AR5 (13)
#define AR6 (14)
#define AR7 (15)
#define SP (15)
#define PS (16)
#define PC (17)
/*
* And now for something completely the same...
*/
#ifndef LOCORE
struct regs {
int r_dreg[8]; /* data registers */
#define r_r0 r_dreg[0] /* r0 for portability */
int r_areg[8]; /* address registers */
#define r_sp r_areg[7] /* user stack pointer */
int r_sr; /* status register (actually a short) */
#define r_ps r_sr
int r_pc; /* program counter */
};
struct stkfmt {
int f_stkfmt : 4; /* stack format */
int : 2;
int f_vector : 10; /* vector offset */
short f_beibase; /* start of bus error info (if any) */
};
/*
* Struct for floating point registers and general state
* for the MC68881 (the sky fpp has no user visible state).
* If fps_flags == FPS_UNUSED, the other 68881 fields have no meaning.
* fps_code and fps_flags are software implemented fields.
* fps_flags is not used when set by user level programs,
* but changing fps_code has the side effect of changing u.u_code.
*/
typedef struct ext_fp {
int fp[3];
} ext_fp; /* extended 96-bit 68881 fp registers */
struct fp_status {
ext_fp fps_regs[8]; /* 68881 floating point regs */
int fps_control; /* 68881 control reg */
int fps_status; /* 68881 status reg */
int fps_iaddr; /* 68881 instruction address reg */
int fps_code; /* additional word for signals */
int fps_flags; /* r/o - unused, idle or busy */
};
#endif !LOCORE
/*
* Values defined for `fps_flags'.
*/
#define FPS_UNUSED 0 /* 68881 never used yet */
#define FPS_IDLE 1 /* 68881 instruction completed */
#define FPS_BUSY 2 /* 68881 instruction interrupted */
/*
* The EXT_FPS_FLAGS() macro is used to convert a pointer to an
* fp_istate into a value to be used for the user visible state
* found in fps_flags. As a speed optimization, this convertion
* is only done is required (e.g. the PTRACE_GETFPREGS ptrace
* call or when dumping core) instead of on each context switch.
* The tests that we base the state on are that a fpis_vers of
* FPIS_VERSNULL means NULL state, else a fpis_bufsiz of FPIS_IDLESZ
* means IDLE state, else we assume BUSY state.
*/
#define FPIS_VERSNULL 0x0
#define FPIS_IDLESIZE 0x18
#define EXT_FPS_FLAGS(istatep) \
((istatep)->fpis_vers == FPIS_VERSNULL ? FPS_UNUSED : \
(istatep)->fpis_bufsiz == FPIS_IDLESIZE ? FPS_IDLE : FPS_BUSY)
#ifndef LOCORE
/*
* Struct for the internal state of the MC68881
* Although the MC68881 can have a smaller maximum for
* internal state, we allow for more to allow for expansion.
*/
#define FPIS_BUFSIZ 0xc0
struct fp_istate {
unsigned char fpis_vers; /* version number */
unsigned char fpis_bufsiz; /* size of info in fpis_buf */
unsigned short fpis_reserved; /* reserved word */
unsigned char fpis_buf[FPIS_BUFSIZ]; /* fpp internal state buffer */
};
/*
* Structures for the status and data registers are defined here.
* Struct fpa_status are included in the u area.
* Struct fpa_regs is included in struct core.
*/
/* struct fpa_status is saved/restored during context switch */
struct fpa_status {
unsigned int fpas_state; /* STATE, supervisor privileged reg */
unsigned int fpas_imask; /* IMASK */
unsigned int fpas_load_ptr; /* LOAD_PTR */
unsigned int fpas_ierr; /* IERR */
unsigned int fpas_act_instr; /* pipe active instruction halves */
unsigned int fpas_nxt_instr; /* pipe next instruction halves */
unsigned int fpas_act_d1half;/* pipe active data first half */
unsigned int fpas_act_d2half;/* pipe active data second half */
unsigned int fpas_nxt_d1half;/* pipe next data first half */
unsigned int fpas_nxt_d2half;/* pipe next data second half */
unsigned int fpas_mode3_0; /* FPA MODE3_0 register */
unsigned int fpas_wstatus; /* FPA WSTATUS register */
};
/*
* Since there are 32 contexts supported by the FPA hardware,
* when we do context switch on the FPA, we don't save/restore
* the data registers between the FPA and the u area.
* If there are already 32 processes using the fpa concurrently,
* we give an error message to the 33rd process trying to use the fpa.
* (Hopefully there will not be this many processes using FPA concurrently.)
*/
#define FPA_NCONTEXTS 32
#define FPA_NDATA_REGS 32
typedef struct fpa_long {
int fpl_data[2];
} fpa_long; /* 64 bit double precision registers */
/* Struct fpa_regs is included in struct core. */
struct fpa_regs {
unsigned int fpar_flags; /* if zero, other fields are meaningless */
struct fpa_status fpar_status;
fpa_long fpar_data[FPA_NDATA_REGS];
};
/*
* The size of struct fpa_regs is changed from 141 ints in 3.0 to
* 77 ints in 3.x. A pad of this size difference is added to struct core.
*/
#define CORE_PADLEN 64
/*
* If there is going to be external FPU state then we must define the FPU
* variable
*/
struct fpu {
struct fp_status f_fpstatus; /* External FPP state, if any */
struct fpa_regs f_fparegs; /* FPA registers, if any */
int f_pad[CORE_PADLEN]; /* see comment above */
};
#endif !LOCORE
#endif /* !I80960 */
#endif !_REG_

70
gdb/vx-share/vxTypes.h Normal file
View File

@ -0,0 +1,70 @@
/* vxTypes.h - VxWorks type definition header */
/* Copyright 1984-1990 Wind River Systems, Inc. */
/*
modification history
--------------------
01c,05oct90,shl added copyright notice.
made #endif ANSI style.
01b,10aug90,dnw added VOIDFUNCPTR
01a,29may90,del written.
*/
#ifndef INCvxTypesh
#define INCvxTypesh
/* The following stuff must NOT be included if this include file is used
* from assembly language. Just #define ASMLANGUAGE before the include,
* to get rid of it.
*/
#ifndef ASMLANGUAGE
/* vxWorks types */
typedef char INT8;
typedef short INT16;
typedef int INT32;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned int UINT;
typedef unsigned long ULONG;
typedef int BOOL;
typedef int VOID;
typedef int STATUS;
typedef int ARGINT;
typedef int (*FUNCPTR) (); /* ptr to function returning int */
typedef VOID (*VOIDFUNCPTR) (); /* ptr to function returning VOID */
/* historical definitions - now obsolete */
typedef char TINY; /* obsolete */
typedef char TBOOL; /* obsolete */
typedef unsigned char UTINY; /* obsolete */
/* architecture dependent typedefs */
#ifdef CPU_FAMILY
#if CPU_FAMILY==MC680X0
typedef unsigned short INSTR; /* word-aligned instructions */
#endif /* CPU_FAMILY==MC680X0 */
#if CPU_FAMILY==SPARC
typedef unsigned long INSTR; /* 32 bit word-aligned instructions */
#endif /* CPU_FAMILY==SPARC */
#endif
#endif /* ASMLANGUAGE */
#endif /* INCvxTypesh */

177
gdb/vx-share/vxWorks.h Normal file
View File

@ -0,0 +1,177 @@
/* vxWorks.h - VxWorks standard definitions header */
/* Copyright 1984-1990 Wind River Systems, Inc. */
/*
modification history
--------------------
01z,05oct90,shl added copyright notice.
made #endif ANSI style.
01y,28sep90,del added I960 defines.
01x,29may90,del moved types to vxTypes.h
01w,09apr90,jcf added timeout definitions.
01v,24jan90,gae moved network configuration flags here from makefile's.
01u,01sep88,mcl definition of INSTR dependent on processor family; added SPARC.
+gae added MC680X0 and defined CPU_FAMILY.
01t,08apr89,dnw added ifdef to prevent inclusion of vxWorks.h more than once.
01s,22jun88,dnw moved READ, WRITE, and UPDATE back here from ioLib.h.
01r,22apr88,gae oops! forgot some #endif's in 01q.
01q,12apr88,gae removed QUICK & WAIT; added STD_{IN,OUT,ERR}.
fixed #define's of FALSE, TRUE, etc.
moved READ, WRITE, and UPDATE to ioLib.h.
01p,04dec87,dnw added undefine of MC68000 to get around Green Hills bug that
pre-defines MC68000.
01o,12nov87,ecs added type ULONG.
01n,08feb86,dnw added types INSTR, UINT, USHORT.
01m,14oct85,rdc added BUS types.
01l,16jul85,jlf added conditional for NULL and EOF.
01k,24jun85,rdc installed condtional compile so we can include in
assembly language files. See instructions below.
Added System type macro and CPU type macro.
01j,13jun85,dnw cleaned-up, removed more obsolete stuff to wrs.h
01i,11sep84,jlf changed name from wrs.h to vxWorks.h. removed GLOBAL.
01h,03jun84,dnw removed IGNORE declaration.
01g,09apr84,jlf added MEMBER_SIZE macro.
01f,14dec83,dnw added MSB, LSB macros
01e,17nov83,jlf added STATUS type, for routines which return a status.
01d,13jul83,dnw added NELEMENTS macro
01c,14May83,dnw added OFFSET macro
01b,17Feb83,dnw added stuff from Whitesmiths std.h
01a,15Feb83,dnw written
*/
#ifndef INCvxWorksh
#define INCvxWorksh
#if !defined(NULL) || (NULL!=0)
#define NULL 0
#endif
#if !defined(EOF) || (EOF!=(-1))
#define EOF (-1)
#endif
#if !defined(FALSE) || (FALSE!=0)
#define FALSE 0
#endif
#if !defined(TRUE) || (TRUE!=1)
#define TRUE 1
#endif
#define NONE (-1) /* for times when NULL won't do */
#define EOS '\0' /* C string terminator */
/* return status values */
#define OK 0
#define ERROR (-1)
/* timeout defines */
#define NO_WAIT 0
#define WAIT_FOREVER (-1)
/* low-level I/O input, output, error fd's */
#define STD_IN 0
#define STD_OUT 1
#define STD_ERR 2
/* modes - must match O_RDONLY/O_WRONLY/O_RDWR in ioLib.h! */
#define READ 0
#define WRITE 1
#define UPDATE 2
/* SYSTEM types */
#define V7 1 /* ATT version 7 */
#define SYS_V 2 /* ATT System 5 */
#define BSD_4_2 3 /* Berkeley BSD 4.2 */
/* CPU types */
/* The Green Hills compiler pre-defines "MC68000"!! */
#ifdef MC68000
#undef MC68000
#endif
#define MC68000 1
#define MC68010 2
#define MC68020 3
#define MC68030 4
#define MC68040 5
#define MC680X0 9
#define SPARC 10
#ifndef I960
#define I960 20
#endif
#define I960KB 21
#define I960CA 22
#if CPU==MC68000 || CPU==MC68010 || CPU==MC68020 || CPU==MC68030
#define CPU_FAMILY MC680X0
#endif /* CPU==MC68000 || CPU==MC68010 || CPU==MC68020 || CPU==MC68030 */
#if CPU==SPARC
#define CPU_FAMILY SPARC
#endif /* CPU==SPARC */
#if CPU==I960KB
#define CPU_FAMILY I960
#endif /* CPU==I960KB */
#if CPU==I960CA
#define CPU_FAMILY I960
#endif /* CPU==I960CA */
/* BUS types */
#define VME_BUS 1
#define MULTI_BUS 2
/* network configuration parameters */
#define INET /* include internet protocols */
#define BSD 43 /* BSD 4.3 -like OS */
#define BSDDEBUG /* turn on debug */
#define GATEWAY /* tables to be initialized for gateway routing */
/* common macros */
#define MSB(x) (((x) >> 8) & 0xff) /* most signif byte of 2-byte integer */
#define LSB(x) ((x) & 0xff) /* least signif byte of 2-byte integer*/
#define OFFSET(structure, member) /* byte offset of member in structure*/\
((int) &(((structure *) 0) -> member))
#define MEMBER_SIZE(structure, member) /* size of a member of a structure */\
(sizeof (((structure *) 0) -> member))
#define NELEMENTS(array) /* number of elements in an array */ \
(sizeof (array) / sizeof ((array) [0]))
#define FOREVER for (;;)
#define max(x, y) (((x) < (y)) ? (y) : (x))
#define min(x, y) (((x) < (y)) ? (x) : (y))
/* storage class specifier definitions */
#define FAST register
#define IMPORT extern
#define LOCAL static
/* include typedefs - must come after CPU_FAMILY definitions above */
#include "vxTypes.h"
#endif /* INCvxWorksh */

42
gdb/vx-share/wait.h Normal file
View File

@ -0,0 +1,42 @@
/* wait.h - header file for remote wait call */
/*
modification history
--------------------
01a,05jun90,llk borrowed.
*/
/* Define how to access the structure that the wait system call stores.
On many systems, there is a structure defined for this.
But on vanilla-ish USG systems there is not. */
#ifndef HAVE_WAIT_STRUCT
#define WAITTYPE int
#define WIFSTOPPED(w) (((w)&0377) == 0177)
#define WIFSIGNALED(w) (((w)&0377) != 0177 && ((w)&~0377) == 0)
#define WIFEXITED(w) (((w)&0377) == 0)
#define WRETCODE(w) ((w) >> 8)
#define WSTOPSIG(w) ((w) >> 8)
#define WCOREDUMP(w) (((w)&0200) != 0)
#define WTERMSIG(w) ((w) & 0177)
#define WSETEXIT(w, status) ((w) = (status))
#define WSETSTOP(w,sig) ((w) = (0177 | ((sig) << 8)))
#else
#if FALSE
#ifndef ORIG
/* don't include sys/wait.h */
#else ORIG
#include <sys/wait.h>
#endif ORIG
#endif FALSE
#define WAITTYPE union wait
#define WRETCODE(w) (w).w_retcode
#define WSTOPSIG(w) (w).w_stopsig
#define WCOREDUMP(w) (w).w_coredump
#define WTERMSIG(w) (w).w_termsig
#define WSETEXIT(w, status) ((w).w_status = (status))
#define WSETSTOP(w,sig) \
((w).w_stopsig = (sig), (w).w_coredump = 0, (w).w_termsig = 0177)
#endif

82
gdb/vx-share/xdr_ld.c Normal file
View File

@ -0,0 +1,82 @@
/* xdr_ld.c - xdr routines for remote dbx interface to VxWorks */
/* Copyright 1984,1985,1986,1987,1988,1989 Wind River Systems, Inc. */
/*extern char copyright_wind_river[]; static char *copyright=copyright_wind_river;*/
/*
modification history
--------------------
01a,05jun90,llk extracted from xdr_dbx.c.
*/
/*
DESCRIPTION
This module contains the eXternal Data Representation (XDR) routines
for object files that are downloaded to VxWorks. They are used by
remote debuggers that use RPC (such as dbxWorks and vxGdb).
*/
#include "vxWorks.h"
#include "rpc/rpc.h"
#include "xdr_ld.h"
/* forward declarations */
bool_t xdr_String(); /* xdr routine for argument list */
/*******************************************************************************
*
* xdr_String - xdr routine for strings.
*
* Used by xdr_arg_info to handle the actual argument
* strings. normally calls xdr_string - but does something
* reasonable encode of null pointer.
*/
bool_t xdr_String (xdrs, strp)
XDR *xdrs;
char **strp;
{
if ((*strp == NULL) & (xdrs->x_op == XDR_ENCODE))
return(FALSE);
else
return(xdr_string(xdrs, strp, MAXSTRLEN));
}
/*******************************************************************************
*
* xdr_ldfile - xdr routine for a single element in the load table
*/
bool_t xdr_ldfile (xdrs, objp)
XDR *xdrs;
ldfile *objp;
{
if (! xdr_String(xdrs, &objp->name))
return(FALSE);
if (! xdr_int(xdrs, &objp->txt_addr))
return(FALSE);
if (! xdr_int(xdrs, &objp->data_addr))
return(FALSE);
if (! xdr_int(xdrs, &objp->bss_addr))
return(FALSE);
return(TRUE);
}
/*******************************************************************************
*
* xdr_ldtabl -
*
* xdr routine for a list of files and load addresses loaded into VxWorks.
*/
bool_t xdr_ldtabl (xdrs,objp)
XDR *xdrs;
ldtabl *objp;
{
return (xdr_array (xdrs, (char *) &objp->tbl_ent, (UINT *) &objp->tbl_size,
MAXTBLSZ, sizeof(ldfile), xdr_ldfile));
}

41
gdb/vx-share/xdr_ld.h Normal file
View File

@ -0,0 +1,41 @@
/* xdr_ld.h - xdr for additional dbxWorks structures */
/*
modification history
--------------------
01a,05jun90,llk extracted from xdr_dbx.h.
*/
#ifndef INCxdrldh
#define INCxdrldh
#define MAXSTRLEN 256
#define MAXTBLSZ 100
/*
* structure used to pass back the information for a single file
* loaded in VxWorks
*/
struct ldfile {
char *name;
int txt_addr;
int data_addr;
int bss_addr;
};
typedef struct ldfile ldfile;
/*
* structure used to return a list of all files loaded over to
* VxWorks. (VX_STATE_INQ return)
*/
struct ldtabl {
u_int tbl_size;
ldfile *tbl_ent;
};
typedef struct ldtabl ldtabl;
bool_t xdr_ldfile();
bool_t xdr_ldtabl();
#endif INCxdrldh

171
gdb/vx-share/xdr_ptrace.c Normal file
View File

@ -0,0 +1,171 @@
/* xdr_ptrace.c - xdr routines for remote ptrace calls */
/* Copyright 1984,1985,1986,1987,1988,1989 Wind River Systems, Inc. */
/* extern char copyright_wind_river[]; static char *copyright=copyright_wind_river;*/
/*
modification history
--------------------
01a,05jun90,llk extracted from xdr_ptrace.h, version 01c.
*/
#include <vxWorks.h>
#include <rpc/rpc.h>
#include <xdr_ptrace.h>
#define MAX_LEN 32000
/********************************************************************
*
* xdr_regs_ptr -
*
* xdr routine to get regs* branch of discriminated union ptrace_info
*
*/
LOCAL bool_t xdr_regs_ptr(xdrs,objp)
XDR *xdrs;
struct regs **objp;
{
return (xdr_pointer(xdrs, (char **) objp, sizeof(struct regs), xdr_regs));
} /* xdr_regs_ptr */
/********************************************************************
*
* xdr_fp_status_ptr -
*
* xdr routine for fp_status * branch of discrimanated union
*
*/
LOCAL bool_t xdr_fp_status_ptr(xdrs,objp)
XDR *xdrs;
struct fp_status **objp;
{
return(xdr_pointer(xdrs, (char **) objp, sizeof(struct fp_status),
xdr_fp_status));
} /* xdr_fp_status_ptr */
#ifndef I80960
/********************************************************************
*
* xdr_fpa_regs_ptr -
*
* xdr routine for fpa_regs* branch of ptrace_info
*
*/
LOCAL bool_t xdr_fpa_regs_ptr(xdrs,objp)
XDR *xdrs;
struct fpa_regs **objp;
{
if (! xdr_pointer(xdrs, (char **) objp, sizeof(struct fpa_regs),
xdr_fpa_regs))
return(FALSE);
else
return(TRUE);
} /* xdr_fpa_regs_ptr */
#endif
/********************************************************************
*
* xdr_c_bytes_ptr -
*
* xdr routine for counted bytes branch of ptrace_info
*
*/
LOCAL bool_t xdr_c_bytes_ptr(xdrs,objp)
XDR *xdrs;
C_bytes **objp;
{
return(xdr_pointer(xdrs, (char **) objp, sizeof(C_bytes), xdr_c_bytes));
} /* xdr_c_bytes_ptr */
/********************************************************************
*
* xdr_ptrace_info -
*
* xdr routine for discriminated union ptrace_info
*
*/
bool_t xdr_ptrace_info(xdrs,objp)
XDR *xdrs;
Ptrace_info *objp;
{
static struct xdr_discrim choices[] =
{
{ (int) REGS, xdr_regs_ptr },
{ (int) FPREGS, xdr_fp_status_ptr },
#ifndef I80960
{ (int) FPAREGS, xdr_fpa_regs_ptr },
#endif
{ (int) DATA, xdr_c_bytes_ptr },
{ __dontcare__, NULL }
};
return(xdr_union(xdrs, (enum_t *) &objp->ttype,
(char *) &objp->more_data, choices, xdr_void));
} /* xdr_ptrace_info */
/********************************************************************
*
* xdr_rptrace -
*
* xdr routine for remote ptrace data into server
*
*/
bool_t xdr_rptrace(xdrs,objp)
XDR *xdrs;
Rptrace *objp;
{
if (! xdr_int(xdrs, &objp->pid))
return(FALSE);
if (! xdr_int(xdrs, &objp->data))
return(FALSE);
if (! xdr_int(xdrs, &objp->addr))
return(FALSE);
if (! xdr_ptrace_info(xdrs, &objp->info))
return(FALSE);
return(TRUE);
} /* xdr_rptrace */
/********************************************************************
*
* xdr_ptrace_return -
*
* xdr routine for remote ptrace data returned by server
*
*/
bool_t xdr_ptrace_return(xdrs, objp)
XDR *xdrs;
Ptrace_return *objp;
{
if (! xdr_int(xdrs, &objp->status))
return(FALSE);
if (! xdr_int(xdrs, &objp->errno))
return(FALSE);
if (! xdr_ptrace_info(xdrs, &objp->info))
return(FALSE);
return(TRUE);
} /* xdr_ptrace_return */
/********************************************************************
*
* xdr_c_bytes -
*
* xdr routine for counted bytes
*
*/
bool_t xdr_c_bytes(xdrs,objp)
XDR *xdrs;
C_bytes *objp;
{
return(xdr_bytes(xdrs, &objp->bytes, (u_int *) &objp->len, MAX_LEN));
} /* xdr_c_bytes */

68
gdb/vx-share/xdr_ptrace.h Normal file
View File

@ -0,0 +1,68 @@
/* xdr_ptrace.h - xdr header for remote ptrace structures */
/*
modification history
--------------------
01a,05jun90,llk extracted from xdr_ptrace.h.
*/
#include "xdr_regs.h"
#include "reg.h"
/*
* Counted byte structure used by READ/WRITE TEXT/DATA
*/
struct c_bytes {
u_int len;
caddr_t bytes;
};
typedef struct c_bytes C_bytes;
/*
* enum for discriminated union ptrace_info
*/
enum ptype {
NOINFO = 0, /* no additional infomation */
REGS = 1, /* regs (SETREGS) */
FPREGS = 2, /* fp_status (SETFPREGS) */
FPAREGS = 3, /* fpa_regs (SETFPAREGS) */
DATA = 4, /* c_bytes (WRITETEXT/DATA)*/
};
typedef enum ptype ptype;
/*
* discrimnated union for passing additional data to be
* written to the debugged process. With the exception of
* c_bytes, the structures are defined in <machine/reg.h>
*/
struct ptrace_info {
ptype ttype;
caddr_t more_data;
};
typedef struct ptrace_info Ptrace_info;
/*
* structure passed to server on all remote ptrace calls
*/
struct rptrace {
int pid;
int data;
int addr; /* FIX! this really should be caddr_t or something */
Ptrace_info info;
};
typedef struct rptrace Rptrace;
/*
* structure returned by server on all remote ptrace calls
*/
struct ptrace_return {
int status;
int errno;
Ptrace_info info;
};
typedef struct ptrace_return Ptrace_return;
bool_t xdr_c_bytes();
bool_t xdr_ptrace_info();
bool_t xdr_rptrace();
bool_t xdr_ptrace_return();

207
gdb/vx-share/xdr_rdb.c Normal file
View File

@ -0,0 +1,207 @@
/* xdr_rdb.c - xdr routines for Remote Debug interface to VxWorks */
/*
modification history
--------------------
01a,21mar90,llk created using modification 01d of xdr_dbx.c.
*/
/*
DESCRIPTION
This module contains the eXternal Data Representation (XDR) routines
for the RDB interface for VxWorks.
*/
#include "vxWorks.h"
#include <rpc/rpc.h>
#include "xdr_rdb.h"
/* forward declarations */
bool_t
xdr_arg_type(xdrs, objp)
XDR *xdrs;
arg_type *objp;
{
if (!xdr_enum(xdrs, (enum_t *)objp)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_arg_value(xdrs, objp)
XDR *xdrs;
arg_value *objp;
{
if (!xdr_arg_type(xdrs, &objp->type)) {
return (FALSE);
}
switch (objp->type) {
case T_BYTE:
if (!xdr_char(xdrs, &objp->arg_value_u.v_byte)) {
return (FALSE);
}
break;
case T_WORD:
if (!xdr_short(xdrs, &objp->arg_value_u.v_word)) {
return (FALSE);
}
break;
case T_INT:
if (!xdr_int(xdrs, &objp->arg_value_u.v_int)) {
return (FALSE);
}
break;
case T_FLOAT:
if (!xdr_float(xdrs, &objp->arg_value_u.v_fp)) {
return (FALSE);
}
break;
case T_DOUBLE:
if (!xdr_double(xdrs, &objp->arg_value_u.v_dp)) {
return (FALSE);
}
break;
case T_UNKNOWN:
break;
}
return (TRUE);
}
bool_t
xdr_func_call(xdrs, objp)
XDR *xdrs;
func_call *objp;
{
if (!xdr_int(xdrs, &objp->func_addr)) {
return (FALSE);
}
if (!xdr_array(xdrs, (char **)&objp->args.args_val, (u_int *)&objp->args.args_len, MAX_FUNC_ARGS, sizeof(arg_value), xdr_arg_value)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_arg_one(xdrs, objp)
XDR *xdrs;
arg_one *objp;
{
if (!xdr_string(xdrs, objp, MAX_ARG_LEN)) {
return (FALSE);
}
return (TRUE);
}
bool_t
xdr_arg_array(xdrs, objp)
XDR *xdrs;
arg_array *objp;
{
if (!xdr_array(xdrs, (char **)&objp->arg_array_val, (u_int *)&objp->arg_array_len, MAX_ARG_CNT, sizeof(arg_one), xdr_arg_one)) {
return (FALSE);
}
return (TRUE);
}
/*********************************************************************
*
* xdr_EVENT_TYPE -
*
*/
bool_t xdr_EVENT_TYPE(xdrs, objp)
XDR *xdrs;
EVENT_TYPE *objp;
{
if (!xdr_enum (xdrs, (enum_t *) objp))
return (FALSE);
return (TRUE);
}
/*********************************************************************
*
* xdr_RDB_EVENT -
*
*/
bool_t xdr_RDB_EVENT (xdrs, objp)
XDR *xdrs;
RDB_EVENT *objp;
{
if (!xdr_int (xdrs, &objp->status))
return (FALSE);
if (!xdr_int (xdrs, &objp->taskId))
return (FALSE);
if (!xdr_EVENT_TYPE (xdrs, &objp->eventType))
return (FALSE);
if (!xdr_int (xdrs, &objp->sigType))
return (FALSE);
return (TRUE);
}
/*********************************************************************
*
* xdr_TASK_START -
*
*/
bool_t
xdr_TASK_START (xdrs, objp)
XDR *xdrs;
TASK_START *objp;
{
if (!xdr_int (xdrs, &objp->status))
return (FALSE);
if (!xdr_int (xdrs, &objp->pid))
return (FALSE);
return (TRUE);
}
/*********************************************************************
*
* xdr_SYMBOL_ADDR -
*
*/
bool_t
xdr_SYMBOL_ADDR (xdrs, objp)
XDR *xdrs;
SYMBOL_ADDR *objp;
{
if (!xdr_int (xdrs, &objp->status))
return (FALSE);
if (!xdr_u_int (xdrs, &objp->addr))
return (FALSE);
return (TRUE);
}
/*********************************************************************
*
* xdr_SOURCE_STEP -
*
*/
bool_t
xdr_SOURCE_STEP (xdrs, objp)
XDR *xdrs;
SOURCE_STEP *objp;
{
if (!xdr_int (xdrs, &objp->taskId))
return (FALSE);
if (!xdr_u_int (xdrs, &objp->startAddr))
return (FALSE);
if (!xdr_u_int (xdrs, &objp->endAddr))
return (FALSE);
return (TRUE);
}

132
gdb/vx-share/xdr_rdb.h Normal file
View File

@ -0,0 +1,132 @@
/* xdr_rdb.h - xdr for additional rdb structures */
/*
modification history
--------------------
01a,23may90,llk created using xdr_dbx.h.
added arg_array to replace arg_info. arg_info had
MAXNCMDARGS (= 100) as the max limit of char strings,
but it should be MAX_TASK_ARGS (= 10).
*/
#ifndef INCxdrrdbh
#define INCxdrrdbh
enum arg_type {
T_UNKNOWN = 0,
T_BYTE = 1,
T_WORD = 2,
T_INT = 3,
T_FLOAT = 4,
T_DOUBLE = 5,
};
typedef enum arg_type arg_type;
bool_t xdr_arg_type();
struct arg_value {
arg_type type;
union {
char v_byte;
short v_word;
int v_int;
float v_fp;
double v_dp;
} arg_value_u;
};
typedef struct arg_value arg_value;
bool_t xdr_arg_value();
struct func_call {
int func_addr;
struct {
u_int args_len;
arg_value *args_val;
} args;
};
typedef struct func_call func_call;
bool_t xdr_func_call();
typedef char *arg_one;
bool_t xdr_arg_one();
typedef struct {
u_int arg_array_len;
arg_one *arg_array_val;
} arg_array;
bool_t xdr_arg_array();
/*
* Structures used to pass structures required for
* process control but not part of the standard ptrace interface
*/
/*
* arg_info is used to pass arguments into process start
*/
struct arg_info {
int rargc;
char **rargv;
};
typedef struct arg_info Arg_info;
enum EVENT_TYPE {
EVENT_BREAK = 0,
EVENT_STOP = 1,
EVENT_EXIT = 2,
EVENT_BUS_ERR = 3,
EVENT_SUSPEND = 4,
EVENT_ZERO_DIV = 5,
EVENT_SIGNAL = 6,
EVENT_START = 7,
};
typedef enum EVENT_TYPE EVENT_TYPE;
struct RDB_EVENT {
int status;
int taskId;
EVENT_TYPE eventType;
int sigType;
};
typedef struct RDB_EVENT RDB_EVENT;
struct TASK_START {
int status;
int pid;
};
typedef struct TASK_START TASK_START;
struct SYMBOL_ADDR {
int status;
u_int addr;
};
typedef struct SYMBOL_ADDR SYMBOL_ADDR;
struct SOURCE_STEP {
int taskId;
u_int startAddr;
u_int endAddr;
};
typedef struct SOURCE_STEP SOURCE_STEP;
#define MAX_ARG_CNT 10
#define MAX_FUNC_ARGS 100
#define MAX_ARG_LEN 100
bool_t xdr_arg_info();
bool_t xdr_EVENT_TYPE();
bool_t xdr_RDB_EVENT();
bool_t xdr_TASK_START();
bool_t xdr_SYMBOL_ADDR();
bool_t xdr_SOURCE_STEP();
#define RDBPROG (u_long) 0x44444444
#define RDBVERS (u_long) 1
#endif INCxdrrdbh

216
gdb/vx-share/xdr_regs.c Normal file
View File

@ -0,0 +1,216 @@
/* xdr_regs.c - xdr routines for 68k registers */
/* Copyright 1984,1985,1986,1987,1988,1989 Wind River Systems, Inc. */
/*
DESCRIPTION
This module contains the eXternal Data Representation (XDR) routines
for the GDB interface for VxWorks.
*/
#include <vxWorks.h>
#include <rpc/rpc.h>
#include <reg.h>
#include <xdr_regs.h>
#ifdef I80960
/*******************************************************************************
*
* xdr_regs - xdr routine for i960 registers
*/
bool_t xdr_regs (xdrs, objp)
XDR *xdrs;
struct regs *objp;
{
if (! xdr_opaque(xdrs, (char *) objp->r_lreg, 16 * sizeof(int)))
return(FALSE);
if (! xdr_opaque(xdrs, (char *) objp->r_greg, 16 * sizeof(int)))
return(FALSE);
if (! xdr_opaque(xdrs, (char *) &objp->r_pcw, sizeof(int)))
return(FALSE);
if (! xdr_opaque(xdrs, (char *) &objp->r_acw, sizeof(int)))
return(FALSE);
if (! xdr_opaque(xdrs, (char *) &objp->r_tcw, sizeof(int)))
return(FALSE);
return(TRUE);
}
/*******************************************************************************
*
* xdr_fp_status - xdr routine for i960 floating point registers
*/
bool_t xdr_fp_status (xdrs, objp)
XDR *xdrs;
struct fp_status *objp;
{
unsigned int size = 4 * FP_REG_SIZE;
/* We use xdr_bytes to indicate how many bytes of FP regs there are! */
if (! xdr_bytes (xdrs, (char *) objp->fps_regs, &size, 4 * FP_REG_SIZE))
return (FALSE);
return (TRUE);
}
/*******************************************************************************
*
* xdr_ext_fp - xdr for a single fp register
*/
bool_t xdr_ext_fp (xdrs, objp)
XDR *xdrs;
char *objp;
{
unsigned int size = FP_REG_SIZE;
if (! xdr_bytes (xdrs, objp, &size, FP_REG_SIZE))
return(FALSE);
return(TRUE);
}
#else /* Must be 68K if it isn't i960 -- for now. FIXME! */
/*******************************************************************************
*
* xdr_regs - xdr routine for 68k registers
*/
bool_t xdr_regs (xdrs, objp)
XDR *xdrs;
struct regs *objp;
{
if (! xdr_opaque(xdrs, (char *) objp->r_dreg, 8 * sizeof(int)))
return(FALSE);
if (! xdr_opaque(xdrs, (char *) objp->r_areg, 8 * sizeof(int)))
return(FALSE);
if (! xdr_opaque(xdrs, (char *) &objp->r_sr, sizeof(int)))
return(FALSE);
if (! xdr_opaque(xdrs, (char *) &objp->r_pc, sizeof(int)))
return(FALSE);
return(TRUE);
}
/*******************************************************************************
*
* xdr_ext_fp - xdr for a single fp register
*/
bool_t xdr_ext_fp (xdrs, objp)
XDR *xdrs;
ext_fp *objp;
{
if (! xdr_vector(xdrs, (char *) objp->fp, 3, sizeof(int), xdr_int))
return(FALSE);
return(TRUE);
}
/*******************************************************************************
*
* xdr_fp_status - xdr routine for floating point registers
*/
bool_t xdr_fp_status (xdrs, objp)
XDR *xdrs;
struct fp_status *objp;
{
if (! xdr_vector (xdrs, (char *) objp->fps_regs, 8,
sizeof(ext_fp), xdr_ext_fp))
return (FALSE);
if (! xdr_int (xdrs, &objp->fps_control))
return (FALSE);
if (! xdr_int (xdrs, &objp->fps_status))
return (FALSE);
if (! xdr_int (xdrs, &objp->fps_iaddr))
return (FALSE);
if (! xdr_int (xdrs, &objp->fps_code))
return (FALSE);
if (! xdr_int (xdrs, &objp->fps_flags))
return (FALSE);
return (TRUE);
}
/*******************************************************************************
*
* xdr_fpa_status - xdr for fpa status
*/
bool_t xdr_fpa_status (xdrs, objp)
XDR *xdrs;
struct fpa_status *objp;
{
if (! xdr_u_int (xdrs, &objp->fpas_state))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_imask))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_load_ptr))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_ierr))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_act_instr))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_nxt_instr))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_act_d1half))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_act_d2half))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_nxt_d1half))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_nxt_d2half))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_mode3_0))
return (FALSE);
if (! xdr_u_int (xdrs, &objp->fpas_wstatus))
return (FALSE);
return (TRUE);
}
/*******************************************************************************
*
* xdr_fpa_long - xdr for fpa data register
*/
bool_t xdr_fpa_long (xdrs,objp)
XDR *xdrs;
fpa_long *objp;
{
if (! xdr_vector (xdrs, (char *) objp->fpl_data, 2, sizeof(int), xdr_int))
return (FALSE);
return (TRUE);
}
/*******************************************************************************
*
* xdr_fpa_regs - xdr for fpa_regs
*/
bool_t xdr_fpa_regs (xdrs, objp)
XDR *xdrs;
struct fpa_regs *objp;
{
if (! xdr_u_int (xdrs, &objp->fpar_flags))
return (FALSE);
if (! xdr_fpa_status (xdrs, &objp->fpar_status))
return (FALSE);
if (! xdr_vector (xdrs, (char *) objp->fpar_data,
FPA_NDATA_REGS, sizeof(fpa_long), xdr_fpa_long))
return (FALSE);
return (TRUE);
}
#endif /* I80960 */

16
gdb/vx-share/xdr_regs.h Normal file
View File

@ -0,0 +1,16 @@
/* xdr_regs.h - xdr header for 68k registers */
/*
modification history
--------------------
01a,05jun90,llk extracted from xdr_regs.h.
*/
/* xdr structures are defined in reg.h (a bad place for them, i might add) */
bool_t xdr_regs();
bool_t xdr_ext_fp();
bool_t xdr_fp_status();
bool_t xdr_fpa_status();
bool_t xdr_fpa_long();
bool_t xdr_fpa_regs();