1 /* xdr_ld.c - xdr routines for remote dbx interface to VxWorks */ 2 3 /* Copyright 1984, 1985, 1986, 1987, 1988, 1989, 1992, 1993, 1998 4 Free Software Foundation, Inc. 5 6 This code was donated by Wind River Systems, Inc. */ 7 8 /* 9 modification history 10 -------------------- 11 01a,05jun90,llk extracted from xdr_dbx.c. 12 */ 13 14 /* 15 DESCRIPTION 16 This module contains the eXternal Data Representation (XDR) routines 17 for object files that are downloaded to VxWorks. They are used by 18 remote debuggers that use RPC (such as dbxWorks and vxGdb). 19 */ 20 21 #include "defs.h" 22 #include "vxWorks.h" 23 #include "rpc/rpc.h" 24 #include "xdr_ld.h" 25 26 /* forward declarations */ 27 28 bool_t xdr_String(); /* xdr routine for argument list */ 29 30 31 /******************************************************************************* 32 * 33 * xdr_String - xdr routine for strings. 34 * 35 * Used by xdr_arg_info to handle the actual argument 36 * strings. normally calls xdr_string - but does something 37 * reasonable encode of null pointer. 38 */ 39 40 bool_t xdr_String (xdrs, strp) 41 XDR *xdrs; 42 char **strp; 43 44 { 45 if ((*strp == NULL) & (xdrs->x_op == XDR_ENCODE)) 46 return(FALSE); 47 else 48 return(xdr_string(xdrs, strp, MAXSTRLEN)); 49 } 50 /******************************************************************************* 51 * 52 * xdr_ldfile - xdr routine for a single element in the load table 53 */ 54 55 bool_t xdr_ldfile (xdrs, objp) 56 XDR *xdrs; 57 ldfile *objp; 58 59 { 60 if (! xdr_String(xdrs, &objp->name)) 61 return(FALSE); 62 if (! xdr_int(xdrs, &objp->txt_addr)) 63 return(FALSE); 64 if (! xdr_int(xdrs, &objp->data_addr)) 65 return(FALSE); 66 if (! xdr_int(xdrs, &objp->bss_addr)) 67 return(FALSE); 68 69 return(TRUE); 70 } 71 /******************************************************************************* 72 * 73 * xdr_ldtabl - 74 * 75 * xdr routine for a list of files and load addresses loaded into VxWorks. 76 */ 77 78 bool_t xdr_ldtabl (xdrs,objp) 79 XDR *xdrs; 80 ldtabl *objp; 81 82 { 83 return (xdr_array (xdrs, (char **) &objp->tbl_ent, (UINT *) &objp->tbl_size, 84 MAXTBLSZ, sizeof(ldfile), xdr_ldfile)); 85 } 86