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