1 /* Memory-access and commands for remote VxWorks processes, for GDB.
2 Copyright (C) 1990-1991 Free Software Foundation, Inc.
3 Contributed by Wind River Systems and Cygnus Support.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
30 #include "symfile.h" /* for struct complaint */
37 #include <sys/types.h>
39 #include <sys/socket.h>
40 #define free bogon_free /* Sun claims "int free()" not void */
43 #include <sys/time.h> /* UTek's <rpc/rpc.h> doesn't #incl this */
46 #include "xdr_ptrace.h"
49 #include "dbgRpcLib.h"
51 /* get rid of value.h if possible */
55 extern value
call_function_by_hand ();
56 extern void symbol_file_command ();
57 extern int stop_soon_quietly
; /* for wait_for_inferior */
59 static int net_ptrace_clnt_call (); /* Forward decl */
60 static enum clnt_stat
net_clnt_call (); /* Forward decl */
61 extern struct target_ops vx_ops
, vx_run_ops
; /* Forward declaration */
63 /* Saved name of target host and called function for "info files".
67 static char *vx_running
; /* Called function */
69 /* Nonzero means target that is being debugged remotely has a floating
72 static int target_has_fp
;
74 /* Default error message when the network is forking up. */
76 static const char rpcerr
[] = "network target debugging: rpc error";
78 CLIENT
*pClient
; /* client used in net debugging */
79 static int ptraceSock
= RPC_ANYSOCK
;
81 enum clnt_stat
net_clnt_call();
82 static void parse_args ();
84 static struct timeval rpcTimeout
= { 10, 0 };
86 static char *skip_white_space ();
87 static char *find_white_space ();
89 /* Tell the VxWorks target system to download a file.
90 The load addresses of the text, data, and bss segments are
91 stored in pTextAddr, pDataAddr, and *pBssAddr (respectively).
92 Returns 0 for success, -1 for failure. */
95 net_load (filename
, pTextAddr
, pDataAddr
, pBssAddr
)
101 enum clnt_stat status
;
102 struct ldfile ldstruct
;
103 struct timeval load_timeout
;
105 bzero ((char *) &ldstruct
, sizeof (ldstruct
));
107 /* We invoke clnt_call () here directly, instead of through
108 net_clnt_call (), because we need to set a large timeout value.
109 The load on the target side can take quite a while, easily
110 more than 10 seconds. The user can kill this call by typing
111 CTRL-C if there really is a problem with the load.
113 Do not change the tv_sec value without checking -- select() imposes
114 a limit of 10**8 on it for no good reason that I can see... */
116 load_timeout
.tv_sec
= 99999999; /* A large number, effectively inf. */
117 load_timeout
.tv_usec
= 0;
119 status
= clnt_call (pClient
, VX_LOAD
, xdr_wrapstring
, &filename
, xdr_ldfile
,
120 &ldstruct
, load_timeout
);
122 if (status
== RPC_SUCCESS
)
124 if (*ldstruct
.name
== NULL
) /* load failed on VxWorks side */
126 *pTextAddr
= ldstruct
.txt_addr
;
127 *pDataAddr
= ldstruct
.data_addr
;
128 *pBssAddr
= ldstruct
.bss_addr
;
135 /* returns 0 if successful, errno if RPC failed or VxWorks complains. */
138 net_break (addr
, procnum
)
142 enum clnt_stat status
;
144 Rptrace ptrace_in
; /* XXX This is stupid. It doesn't need to be a ptrace
145 structure. How about something smaller? */
147 bzero ((char *) &ptrace_in
, sizeof (ptrace_in
));
150 ptrace_in
.addr
= addr
;
151 ptrace_in
.pid
= inferior_pid
;
153 status
= net_clnt_call (procnum
, xdr_rptrace
, &ptrace_in
, xdr_int
,
156 if (status
!= RPC_SUCCESS
)
159 if (break_status
== -1)
161 return break_status
; /* probably (FIXME) zero */
164 /* returns 0 if successful, errno otherwise */
167 vx_insert_breakpoint (addr
)
170 return net_break (addr
, VX_BREAK_ADD
);
173 /* returns 0 if successful, errno otherwise */
176 vx_remove_breakpoint (addr
)
179 return net_break (addr
, VX_BREAK_DELETE
);
182 /* Call a function on the VxWorks target system.
183 ARGS is a vector of values of arguments (NARGS of them).
184 FUNCTION is a value, the function to be called.
185 Returns a struct value * representing what the function returned.
186 May fail to return, if a breakpoint or signal is hit
187 during the execution of the function. */
190 /* FIXME, function calls are really fried. GO back to manual method. */
192 vx_call_function (function
, nargs
, args
)
197 register CORE_ADDR sp
;
200 static REGISTER_TYPE dummy
[] = CALL_DUMMY
;
201 REGISTER_TYPE dummy1
[sizeof dummy
/ sizeof (REGISTER_TYPE
)];
203 struct type
*value_type
;
204 unsigned char struct_return
;
205 CORE_ADDR struct_addr
;
206 struct inferior_status inf_status
;
207 struct cleanup
*old_chain
;
211 save_inferior_status (&inf_status
, 1);
212 old_chain
= make_cleanup (restore_inferior_status
, &inf_status
);
214 /* PUSH_DUMMY_FRAME is responsible for saving the inferior registers
215 (and POP_FRAME for restoring them). (At least on most machines)
216 they are saved on the stack in the inferior. */
219 old_sp
= sp
= read_register (SP_REGNUM
);
221 #if 1 INNER_THAN 2 /* Stack grows down */
224 #else /* Stack grows up */
229 funaddr
= find_function_addr (function
, &value_type
);
232 struct block
*b
= block_for_pc (funaddr
);
233 /* If compiled without -g, assume GCC. */
234 using_gcc
= b
== NULL
|| BLOCK_GCC_COMPILED (b
);
237 /* Are we returning a value using a structure return or a normal
240 struct_return
= using_struct_return (function
, funaddr
, value_type
,
243 /* Create a call sequence customized for this function
244 and the number of arguments for it. */
245 bcopy (dummy
, dummy1
, sizeof dummy
);
246 FIX_CALL_DUMMY (dummy1
, start_sp
, funaddr
, nargs
, args
,
247 value_type
, using_gcc
);
249 #if CALL_DUMMY_LOCATION == ON_STACK
250 write_memory (start_sp
, dummy1
, sizeof dummy
);
252 #else /* Not on stack. */
253 #if CALL_DUMMY_LOCATION == BEFORE_TEXT_END
254 /* Convex Unix prohibits executing in the stack segment. */
255 /* Hope there is empty room at the top of the text segment. */
259 for (start_sp
= text_end
- sizeof dummy
; start_sp
< text_end
; ++start_sp
)
260 if (read_memory_integer (start_sp
, 1) != 0)
261 error ("text segment full -- no place to put call");
264 start_sp
= text_end
- sizeof dummy
;
265 write_memory (start_sp
, dummy1
, sizeof dummy
);
267 #else /* After text_end. */
272 errcode
= target_write_memory (start_sp
, dummy1
, sizeof dummy
);
274 error ("Cannot write text segment -- call_function failed");
276 #endif /* After text_end. */
277 #endif /* Not on stack. */
280 /* If stack grows down, we must leave a hole at the top. */
284 /* Reserve space for the return structure to be written on the
285 stack, if necessary */
288 len
+= TYPE_LENGTH (value_type
);
290 for (i
= nargs
- 1; i
>= 0; i
--)
291 len
+= TYPE_LENGTH (VALUE_TYPE (value_arg_coerce (args
[i
])));
292 #ifdef CALL_DUMMY_STACK_ADJUST
293 len
+= CALL_DUMMY_STACK_ADJUST
;
296 sp
-= STACK_ALIGN (len
) - len
;
298 sp
+= STACK_ALIGN (len
) - len
;
301 #endif /* STACK_ALIGN */
303 /* Reserve space for the return structure to be written on the
304 stack, if necessary */
309 sp
-= TYPE_LENGTH (value_type
);
313 sp
+= TYPE_LENGTH (value_type
);
317 #if defined (REG_STRUCT_HAS_ADDR)
319 /* This is a machine like the sparc, where we need to pass a pointer
320 to the structure, not the structure itself. */
321 if (REG_STRUCT_HAS_ADDR (using_gcc
))
322 for (i
= nargs
- 1; i
>= 0; i
--)
323 if (TYPE_CODE (VALUE_TYPE (args
[i
])) == TYPE_CODE_STRUCT
)
326 #if !(1 INNER_THAN 2)
327 /* The stack grows up, so the address of the thing we push
328 is the stack pointer before we push it. */
331 /* Push the structure. */
332 sp
= value_push (sp
, args
[i
]);
334 /* The stack grows down, so the address of the thing we push
335 is the stack pointer after we push it. */
338 /* The value we're going to pass is the address of the thing
340 args
[i
] = value_from_long (builtin_type_long
, (LONGEST
) addr
);
343 #endif /* REG_STRUCT_HAS_ADDR. */
345 #ifdef PUSH_ARGUMENTS
346 PUSH_ARGUMENTS(nargs
, args
, sp
, struct_return
, struct_addr
);
347 #else /* !PUSH_ARGUMENTS */
348 for (i
= nargs
- 1; i
>= 0; i
--)
349 sp
= value_arg_push (sp
, args
[i
]);
350 #endif /* !PUSH_ARGUMENTS */
352 #ifdef CALL_DUMMY_STACK_ADJUST
354 sp
-= CALL_DUMMY_STACK_ADJUST
;
356 sp
+= CALL_DUMMY_STACK_ADJUST
;
358 #endif /* CALL_DUMMY_STACK_ADJUST */
360 /* Store the address at which the structure is supposed to be
361 written. Note that this (and the code which reserved the space
362 above) assumes that gcc was used to compile this function. Since
363 it doesn't cost us anything but space and if the function is pcc
364 it will ignore this value, we will make that assumption.
366 Also note that on some machines (like the sparc) pcc uses a
367 convention like gcc's. */
370 STORE_STRUCT_RETURN (struct_addr
, sp
);
372 /* Write the stack pointer. This is here because the statements above
373 might fool with it. On SPARC, this write also stores the register
374 window into the right place in the new stack frame, which otherwise
375 wouldn't happen. (See write_inferior_registers in sparc-xdep.c.) */
376 write_register (SP_REGNUM
, sp
);
378 /* Figure out the value returned by the function. */
380 char retbuf
[REGISTER_BYTES
];
382 /* Execute the stack dummy routine, calling FUNCTION.
383 When it is done, discard the empty frame
384 after storing the contents of all regs into retbuf. */
385 run_stack_dummy (start_sp
+ CALL_DUMMY_START_OFFSET
, retbuf
);
387 do_cleanups (old_chain
);
389 return value_being_returned (value_type
, retbuf
, struct_return
);
392 /* should return a value of some sort */
395 vx_call_function (funcAddr
, nargs
, args
, valueType
)
399 struct type
* valueType
;
404 enum clnt_stat status
;
406 arg_value funcReturn
;
409 argValue
= (arg_value
*) xmalloc (nargs
* sizeof (arg_value
));
411 bzero (argValue
, nargs
* sizeof (arg_value
));
412 bzero (&funcReturn
, sizeof (funcReturn
));
414 for (i
= nargs
- 1; i
>= 0; i
--)
416 len
= TYPE_LENGTH (VALUE_TYPE (args
[i
]));
418 switch (TYPE_CODE (VALUE_TYPE (args
[i
])))
420 /* XXX put other types here. Where's CHAR, etc??? */
423 argValue
[i
].type
= T_FLOAT
;
429 argValue
[i
].type
= T_INT
;
432 case TYPE_CODE_UNDEF
:
433 case TYPE_CODE_ARRAY
:
434 case TYPE_CODE_STRUCT
:
435 case TYPE_CODE_UNION
:
438 case TYPE_CODE_RANGE
:
439 case TYPE_CODE_PASCAL_ARRAY
:
440 case TYPE_CODE_MEMBER
: /* C++ */
441 case TYPE_CODE_METHOD
: /* C++ */
442 case TYPE_CODE_REF
: /* C++ */
444 error ("No corresponding VxWorks type for %d. CHECK IT OUT!!!\n",
445 TYPE_CODE(VALUE_TYPE(args
[i
])));
447 if (TYPE_CODE(VALUE_TYPE(args
[i
])) == TYPE_CODE_FUNC
)
448 argValue
[i
].arg_value_u
.v_int
= VALUE_ADDRESS(args
[i
]);
450 bcopy (VALUE_CONTENTS (args
[i
]), (char *) &argValue
[i
].arg_value_u
,
454 /* XXX what should the type of this function addr be?
455 * XXX Both in gdb and vxWorks
457 funcInfo
.func_addr
= (int) funcAddr
;
458 funcInfo
.args
.args_len
= nargs
;
459 funcInfo
.args
.args_val
= argValue
;
461 status
= net_clnt_call (VX_CALL_FUNC
, xdr_func_call
, (char *) &funcInfo
,
462 xdr_arg_value
, &funcReturn
);
464 free ((char *) argValue
);
466 if (status
== RPC_SUCCESS
)
468 /* XXX this assumes that vxWorks ALWAYS returns an int, and that
469 * XXX gdb isn't expecting anything more
473 if (funcReturn.type == T_UNKNOWN)
476 gdbValue
= allocate_value (valueType
);
477 bcopy (&funcReturn
.arg_value_u
.v_int
, VALUE_CONTENTS (gdbValue
),
486 /* Start an inferior process and sets inferior_pid to its pid.
487 EXEC_FILE is the file to run.
488 ALLARGS is a string containing the arguments to the program.
489 ENV is the environment vector to pass.
490 Returns process id. Errors reported with error().
491 On VxWorks, we ignore exec_file. */
494 vx_create_inferior (exec_file
, args
, env
)
499 enum clnt_stat status
;
501 TASK_START taskStart
;
503 bzero ((char *) &passArgs
, sizeof (passArgs
));
504 bzero ((char *) &taskStart
, sizeof (taskStart
));
506 /* parse arguments, put them in passArgs */
508 parse_args (args
, &passArgs
);
510 if (passArgs
.arg_array_len
== 0)
511 error ("You must specify a function name to run, and arguments if any");
513 status
= net_clnt_call (PROCESS_START
, xdr_arg_array
, &passArgs
,
514 xdr_TASK_START
, &taskStart
);
516 if ((status
!= RPC_SUCCESS
) || (taskStart
.status
== -1))
517 error ("Can't create process on remote target machine");
519 /* Save the name of the running function */
520 vx_running
= savestring (passArgs
.arg_array_val
[0],
521 strlen (passArgs
.arg_array_val
[0]));
523 #ifdef CREATE_INFERIOR_HOOK
524 CREATE_INFERIOR_HOOK (pid
);
527 push_target (&vx_run_ops
);
528 inferior_pid
= taskStart
.pid
;
530 #if defined (START_INFERIOR_HOOK)
531 START_INFERIOR_HOOK ();
534 /* We will get a trace trap after one instruction.
535 Insert breakpoints and continue. */
537 init_wait_for_inferior ();
539 /* Set up the "saved terminal modes" of the inferior
540 based on what modes we are starting it with. */
541 target_terminal_init ();
543 /* Install inferior's terminal modes. */
544 target_terminal_inferior ();
546 /* remote_start(args); */
547 /* trap_expected = 0; */
548 stop_soon_quietly
= 1;
549 wait_for_inferior (); /* Get the task spawn event */
550 stop_soon_quietly
= 0;
552 /* insert_step_breakpoint (); FIXME, do we need this? */
556 /* Fill ARGSTRUCT in argc/argv form with the arguments from the
557 argument string ARGSTRING. */
560 parse_args (arg_string
, arg_struct
)
561 register char *arg_string
;
562 arg_array
*arg_struct
;
564 register int arg_count
= 0; /* number of arguments */
565 register int arg_index
= 0;
568 bzero ((char *) arg_struct
, sizeof (arg_array
));
570 /* first count how many arguments there are */
575 if (*(p0
= skip_white_space (p0
)) == '\0')
577 p0
= find_white_space (p0
);
581 arg_struct
->arg_array_len
= arg_count
;
582 arg_struct
->arg_array_val
= (char **) xmalloc ((arg_count
+ 1)
585 /* now copy argument strings into arg_struct. */
587 while (*(arg_string
= skip_white_space (arg_string
)))
589 p0
= find_white_space (arg_string
);
590 arg_struct
->arg_array_val
[arg_index
++] = savestring (arg_string
,
595 arg_struct
->arg_array_val
[arg_count
] = NULL
;
598 /* Advance a string pointer across whitespace and return a pointer
599 to the first non-white character. */
605 while (*p
== ' ' || *p
== '\t')
610 /* Search for the first unquoted whitespace character in a string.
611 Returns a pointer to the character, or to the null terminator
612 if no whitespace is found. */
620 while ((c
= *p
) != ' ' && c
!= '\t' && c
)
622 if (c
== '\'' || c
== '"')
624 while (*++p
!= c
&& *p
)
637 /* Poll the VxWorks target system for an event related
638 to the debugged task.
639 Returns -1 if remote wait failed, task status otherwise. */
646 enum clnt_stat status
;
648 bzero ((char *) pEvent
, sizeof (RDB_EVENT
));
651 status
= net_clnt_call (PROCESS_WAIT
, xdr_int
, &pid
, xdr_RDB_EVENT
, pEvent
);
653 return (status
== RPC_SUCCESS
)? pEvent
->status
: -1;
656 /* Suspend the remote task.
657 Returns -1 if suspend fails on target system, 0 otherwise. */
664 enum clnt_stat status
;
668 /* don't let rdbTask suspend itself by passing a pid of 0 */
670 if ((pid
= inferior_pid
) == 0)
673 status
= net_clnt_call (VX_TASK_SUSPEND
, xdr_int
, &pid
, xdr_int
,
676 return (status
== RPC_SUCCESS
)? quit_status
: -1;
679 /* Read a register or registers from the remote system. */
682 vx_read_register (regno
)
687 Ptrace_return ptrace_out
;
688 struct regs inferior_registers
;
689 struct fp_status inferior_fp_registers
;
690 extern char registers
[];
692 bzero ((char *) &ptrace_in
, sizeof (ptrace_in
));
693 bzero ((char *) &ptrace_out
, sizeof (ptrace_out
));
695 /* FIXME, eventually only get the ones we need. */
696 registers_fetched ();
698 ptrace_in
.pid
= inferior_pid
;
699 ptrace_out
.info
.more_data
= (caddr_t
) &inferior_registers
;
700 status
= net_ptrace_clnt_call (PTRACE_GETREGS
, &ptrace_in
, &ptrace_out
);
703 if (ptrace_out
.status
== -1)
705 errno
= ptrace_out
.errno
;
711 bcopy ((char *) inferior_registers
.r_lreg
,
712 ®isters
[REGISTER_BYTE (R0_REGNUM
)], 16 * sizeof (int));
713 bcopy ((char *) inferior_registers
.r_greg
,
714 ®isters
[REGISTER_BYTE (G0_REGNUM
)], 16 * sizeof (int));
716 /* Don't assume that a location in registers[] is properly aligned. */
718 bcopy ((char *) &inferior_registers
.r_pcw
,
719 ®isters
[REGISTER_BYTE (PCW_REGNUM
)], sizeof (int));
720 bcopy ((char *) &inferior_registers
.r_acw
,
721 ®isters
[REGISTER_BYTE (ACW_REGNUM
)], sizeof (int));
722 bcopy ((char *) &inferior_registers
.r_lreg
[2], /* r2 (RIP) -> IP */
723 ®isters
[REGISTER_BYTE (IP_REGNUM
)], sizeof (int));
724 bcopy ((char *) &inferior_registers
.r_tcw
,
725 ®isters
[REGISTER_BYTE (TCW_REGNUM
)], sizeof (int));
727 /* If the target has floating point registers, fetch them.
728 Otherwise, zero the floating point register values in
729 registers[] for good measure, even though we might not
734 ptrace_in
.pid
= inferior_pid
;
735 ptrace_out
.info
.more_data
= (caddr_t
) &inferior_fp_registers
;
736 status
= net_ptrace_clnt_call (PTRACE_GETFPREGS
, &ptrace_in
, &ptrace_out
);
739 if (ptrace_out
.status
== -1)
741 errno
= ptrace_out
.errno
;
745 bcopy (&inferior_fp_registers
, ®isters
[REGISTER_BYTE (FP0_REGNUM
)],
746 REGISTER_RAW_SIZE (FP0_REGNUM
) * 4);
750 bzero ((char *) ®isters
[REGISTER_BYTE (FP0_REGNUM
)],
751 REGISTER_RAW_SIZE (FP0_REGNUM
) * 4);
754 #else /* not 960, thus must be 68000: FIXME! */
756 bcopy (&inferior_registers
, registers
, 16 * 4);
757 *(int *)®isters
[REGISTER_BYTE (PS_REGNUM
)] = inferior_registers
.r_ps
;
758 *(int *)®isters
[REGISTER_BYTE (PC_REGNUM
)] = inferior_registers
.r_pc
;
762 ptrace_in
.pid
= inferior_pid
;
763 ptrace_out
.info
.more_data
= (caddr_t
) &inferior_fp_registers
;
764 status
= net_ptrace_clnt_call (PTRACE_GETFPREGS
, &ptrace_in
, &ptrace_out
);
767 if (ptrace_out
.status
== -1)
769 errno
= ptrace_out
.errno
;
773 bcopy (&inferior_fp_registers
, ®isters
[REGISTER_BYTE (FP0_REGNUM
)],
774 sizeof inferior_fp_registers
.fps_regs
);
775 bcopy (&inferior_fp_registers
.fps_control
,
776 ®isters
[REGISTER_BYTE (FPC_REGNUM
)],
777 sizeof inferior_fp_registers
- sizeof inferior_fp_registers
.fps_regs
);
781 bzero (®isters
[REGISTER_BYTE (FP0_REGNUM
)],
782 sizeof inferior_fp_registers
.fps_regs
);
783 bzero (®isters
[REGISTER_BYTE (FPC_REGNUM
)],
784 sizeof inferior_fp_registers
- sizeof inferior_fp_registers
.fps_regs
);
786 #endif /* various architectures */
791 /* Prepare to store registers. Since we will store all of them,
792 read out their current values now. */
795 vx_prepare_to_store ()
797 vx_read_register (-1);
801 /* Store our register values back into the inferior.
802 If REGNO is -1, do this for all registers.
803 Otherwise, REGNO specifies which register (so we can save time). */
804 /* FIXME, look at REGNO to save time here */
806 vx_write_register (regno
)
809 struct regs inferior_registers
;
810 struct fp_status inferior_fp_registers
;
811 extern char registers
[];
814 Ptrace_return ptrace_out
;
816 bzero ((char *) &ptrace_in
, sizeof (ptrace_in
));
817 bzero ((char *) &ptrace_out
, sizeof (ptrace_out
));
821 bcopy (®isters
[REGISTER_BYTE (R0_REGNUM
)],
822 (char *) inferior_registers
.r_lreg
, 16 * sizeof (int));
823 bcopy (®isters
[REGISTER_BYTE (G0_REGNUM
)],
824 (char *) inferior_registers
.r_greg
, 16 * sizeof (int));
826 /* Don't assume that a location in registers[] is properly aligned. */
828 bcopy (®isters
[REGISTER_BYTE (PCW_REGNUM
)],
829 (char *) &inferior_registers
.r_pcw
, sizeof (int));
830 bcopy (®isters
[REGISTER_BYTE (ACW_REGNUM
)],
831 (char *) &inferior_registers
.r_acw
, sizeof (int));
832 bcopy (®isters
[REGISTER_BYTE (TCW_REGNUM
)],
833 (char *) &inferior_registers
.r_tcw
, sizeof (int));
835 #else /* not 960 -- assume 68k -- FIXME */
837 bcopy (registers
, &inferior_registers
, 16 * 4);
838 inferior_registers
.r_ps
= *(int *)®isters
[REGISTER_BYTE (PS_REGNUM
)];
839 inferior_registers
.r_pc
= *(int *)®isters
[REGISTER_BYTE (PC_REGNUM
)];
841 #endif /* Different register sets */
843 ptrace_in
.pid
= inferior_pid
;
844 ptrace_in
.info
.ttype
= REGS
;
845 ptrace_in
.info
.more_data
= (caddr_t
) &inferior_registers
;
847 /* XXX change second param to be a proc number */
848 status
= net_ptrace_clnt_call (PTRACE_SETREGS
, &ptrace_in
, &ptrace_out
);
851 if (ptrace_out
.status
== -1)
853 errno
= ptrace_out
.errno
;
857 /* Store floating point registers if the target has them. */
863 bcopy (®isters
[REGISTER_BYTE (FP0_REGNUM
)], &inferior_fp_registers
,
864 sizeof inferior_fp_registers
.fps_regs
);
866 #else /* not 960 -- assume 68k -- FIXME */
868 bcopy (®isters
[REGISTER_BYTE (FP0_REGNUM
)], &inferior_fp_registers
,
869 sizeof inferior_fp_registers
.fps_regs
);
870 bcopy (®isters
[REGISTER_BYTE (FPC_REGNUM
)],
871 &inferior_fp_registers
.fps_control
,
872 sizeof inferior_fp_registers
- sizeof inferior_fp_registers
.fps_regs
);
874 #endif /* Different register sets */
876 ptrace_in
.pid
= inferior_pid
;
877 ptrace_in
.info
.ttype
= FPREGS
;
878 ptrace_in
.info
.more_data
= (caddr_t
) &inferior_fp_registers
;
880 status
= net_ptrace_clnt_call (PTRACE_SETFPREGS
, &ptrace_in
, &ptrace_out
);
883 if (ptrace_out
.status
== -1)
885 errno
= ptrace_out
.errno
;
892 /* Copy LEN bytes to or from remote inferior's memory starting at MEMADDR
893 to debugger memory starting at MYADDR. WRITE is true if writing to the
895 Result is the number of bytes written or read (zero if error). The
896 protocol allows us to return a negative count, indicating that we can't
897 handle the current address but can handle one N bytes further, but
898 vxworks doesn't give us that information. */
901 vx_xfer_memory (memaddr
, myaddr
, len
, write
, target
)
906 struct target_ops
*target
; /* ignored */
910 Ptrace_return ptrace_out
;
913 bzero ((char *) &ptrace_in
, sizeof (ptrace_in
));
914 bzero ((char *) &ptrace_out
, sizeof (ptrace_out
));
916 ptrace_in
.pid
= inferior_pid
; /* XXX pid unnecessary for READDATA */
917 ptrace_in
.addr
= (int) memaddr
; /* Where from */
918 ptrace_in
.data
= len
; /* How many bytes */
922 ptrace_in
.info
.ttype
= DATA
;
923 ptrace_in
.info
.more_data
= (caddr_t
) &data
;
925 data
.bytes
= (caddr_t
) myaddr
; /* Where from */
926 data
.len
= len
; /* How many bytes (again, for XDR) */
928 /* XXX change second param to be a proc number */
929 status
= net_ptrace_clnt_call (PTRACE_WRITEDATA
, &ptrace_in
, &ptrace_out
);
933 ptrace_out
.info
.more_data
= (caddr_t
) &data
;
934 data
.bytes
= myaddr
; /* Where to */
935 data
.len
= len
; /* How many (again, for XDR) */
937 /* XXX change second param to be a proc number */
938 status
= net_ptrace_clnt_call (PTRACE_READDATA
, &ptrace_in
, &ptrace_out
);
943 if (ptrace_out
.status
== -1)
945 return 0; /* No bytes moved */
947 return len
; /* Moved *all* the bytes */
953 printf ("\tAttached to host `%s'", vx_host
);
954 printf (", which has %sfloating point", target_has_fp
? "": "no ");
961 printf ("\tRunning %s VxWorks process 0x%x",
962 vx_running
? "child": "attached",
965 printf (", function `%s'", vx_running
);
970 vx_resume (step
, siggnal
)
976 Ptrace_return ptrace_out
;
978 if (siggnal
!= 0 && siggnal
!= stop_signal
)
979 error ("Cannot send signals to VxWorks processes");
981 bzero ((char *) &ptrace_in
, sizeof (ptrace_in
));
982 bzero ((char *) &ptrace_out
, sizeof (ptrace_out
));
984 ptrace_in
.pid
= inferior_pid
;
985 ptrace_in
.addr
= 1; /* Target side insists on this, or it panics. */
987 /* XXX change second param to be a proc number */
988 status
= net_ptrace_clnt_call (step
? PTRACE_SINGLESTEP
: PTRACE_CONT
,
989 &ptrace_in
, &ptrace_out
);
992 if (ptrace_out
.status
== -1)
994 errno
= ptrace_out
.errno
;
995 perror_with_name ("Resuming remote process");
1000 vx_mourn_inferior ()
1002 pop_target (); /* Pop back to no-child state */
1003 generic_mourn_inferior ();
1007 /* This function allows the addition of incrementally linked object files. */
1010 vx_load_command (arg_string
, from_tty
)
1014 CORE_ADDR text_addr
;
1015 CORE_ADDR data_addr
;
1018 if (arg_string
== 0)
1019 error ("The load command takes a file name");
1021 arg_string
= tilde_expand (arg_string
);
1022 make_cleanup (free
, arg_string
);
1028 if (net_load (arg_string
, &text_addr
, &data_addr
, &bss_addr
) == -1)
1029 error ("Load failed on target machine");
1032 /* FIXME, for now we ignore data_addr and bss_addr. */
1033 symbol_file_add (arg_string
, from_tty
, text_addr
, 0);
1036 #ifdef FIXME /* Not ready for prime time */
1037 /* Single step the target program at the source or machine level.
1038 Takes an error exit if rpc fails.
1039 Returns -1 if remote single-step operation fails, else 0. */
1044 enum clnt_stat status
;
1046 SOURCE_STEP source_step
;
1048 source_step
.taskId
= inferior_pid
;
1052 source_step
.startAddr
= step_range_start
;
1053 source_step
.endAddr
= step_range_end
;
1057 source_step
.startAddr
= 0;
1058 source_step
.endAddr
= 0;
1061 status
= net_clnt_call (VX_SOURCE_STEP
, xdr_SOURCE_STEP
, &source_step
,
1062 xdr_int
, &step_status
);
1064 if (status
== RPC_SUCCESS
)
1071 /* Emulate ptrace using RPC calls to the VxWorks target system.
1072 Returns nonzero (-1) if RPC status to VxWorks is bad, 0 otherwise. */
1075 net_ptrace_clnt_call (request
, pPtraceIn
, pPtraceOut
)
1076 enum ptracereq request
;
1078 Ptrace_return
*pPtraceOut
;
1080 enum clnt_stat status
;
1082 status
= net_clnt_call (request
, xdr_rptrace
, pPtraceIn
, xdr_ptrace_return
,
1085 if (status
!= RPC_SUCCESS
)
1091 /* Query the target for the name of the file from which VxWorks was
1092 booted. pBootFile is the address of a pointer to the buffer to
1093 receive the file name; if the pointer pointed to by pBootFile is
1094 NULL, memory for the buffer will be allocated by XDR.
1095 Returns -1 if rpc failed, 0 otherwise. */
1098 net_get_boot_file (pBootFile
)
1101 enum clnt_stat status
;
1103 status
= net_clnt_call (VX_BOOT_FILE_INQ
, xdr_void
, (char *) 0,
1104 xdr_wrapstring
, pBootFile
);
1105 return (status
== RPC_SUCCESS
) ? 0 : -1;
1108 /* Fetch a list of loaded object modules from the VxWorks target.
1109 Returns -1 if rpc failed, 0 otherwise
1110 There's no way to check if the returned loadTable is correct.
1111 VxWorks doesn't check it. */
1114 net_get_symbols (pLoadTable
)
1115 ldtabl
*pLoadTable
; /* return pointer to ldtabl here */
1117 enum clnt_stat status
;
1119 bzero ((char *) pLoadTable
, sizeof (struct ldtabl
));
1121 status
= net_clnt_call (VX_STATE_INQ
, xdr_void
, 0, xdr_ldtabl
, pLoadTable
);
1122 return (status
== RPC_SUCCESS
) ? 0 : -1;
1125 /* Look up a symbol in the VxWorks target's symbol table.
1126 Returns status of symbol read on target side (0=success, -1=fail)
1127 Returns -1 and complain()s if rpc fails. */
1129 struct complaint cant_contact_target
=
1130 {"Lost contact with VxWorks target", 0, 0};
1133 vx_lookup_symbol (name
, pAddr
)
1134 char *name
; /* symbol name */
1137 enum clnt_stat status
;
1138 SYMBOL_ADDR symbolAddr
;
1141 bzero ((char *) &symbolAddr
, sizeof (symbolAddr
));
1143 status
= net_clnt_call (VX_SYMBOL_INQ
, xdr_wrapstring
, &name
,
1144 xdr_SYMBOL_ADDR
, &symbolAddr
);
1145 if (status
!= RPC_SUCCESS
) {
1146 complain (&cant_contact_target
, 0);
1150 *pAddr
= symbolAddr
.addr
;
1151 return symbolAddr
.status
;
1154 /* Check to see if the VxWorks target has a floating point coprocessor.
1155 Returns 1 if target has floating point processor, 0 otherwise.
1156 Calls error() if rpc fails. */
1161 enum clnt_stat status
;
1162 bool_t fp
= 0; /* true if fp processor is present on target board */
1164 status
= net_clnt_call (VX_FP_INQUIRE
, xdr_void
, 0, xdr_bool
, &fp
);
1165 if (status
!= RPC_SUCCESS
)
1171 /* Establish an RPC connection with the VxWorks target system.
1172 Calls error () if unable to establish connection. */
1178 struct sockaddr_in destAddr
;
1179 struct hostent
*destHost
;
1181 /* get the internet address for the given host */
1183 if ((destHost
= (struct hostent
*) gethostbyname (host
)) == NULL
)
1184 error ("Invalid hostname. Couldn't find remote host address.");
1186 bzero (&destAddr
, sizeof (destAddr
));
1188 destAddr
.sin_addr
.s_addr
= * (u_long
*) destHost
->h_addr
;
1189 destAddr
.sin_family
= AF_INET
;
1190 destAddr
.sin_port
= 0; /* set to actual port that remote
1191 ptrace is listening on. */
1193 /* Create a tcp client transport on which to issue
1194 calls to the remote ptrace server. */
1196 ptraceSock
= RPC_ANYSOCK
;
1197 pClient
= clnttcp_create (&destAddr
, RDBPROG
, RDBVERS
, &ptraceSock
, 0, 0);
1198 /* FIXME, here is where we deal with different version numbers of the proto */
1200 if (pClient
== NULL
)
1202 clnt_pcreateerror ("\tnet_connect");
1203 error ("Couldn't connect to remote target.");
1207 /* Sleep for the specified number of milliseconds
1208 * (assumed to be less than 1000).
1209 * If select () is interrupted, returns immediately;
1210 * takes an error exit if select () fails for some other reason.
1217 struct timeval select_timeout
;
1220 select_timeout
.tv_sec
= 0;
1221 select_timeout
.tv_usec
= ms
* 1000;
1223 status
= select (0, (fd_set
*) 0, (fd_set
*) 0, (fd_set
*) 0, &select_timeout
);
1225 if (status
< 0 && errno
!= EINTR
)
1226 perror_with_name ("select");
1229 /* Wait for control to return from inferior to debugger.
1230 If inferior gets a signal, we may decide to start it up again
1231 instead of returning. That is why there is a loop in this function.
1232 When this function actually returns it means the inferior
1233 should be left stopped and GDB should read more commands. */
1235 /* For network debugging with VxWorks.
1236 * VxWorks knows when tasks hit breakpoints, receive signals, exit, etc,
1237 * so vx_wait() receives this information directly from
1238 * VxWorks instead of trying to figure out what happenned via a wait() call.
1252 /* If CTRL-C is hit during this loop,
1253 suspend the inferior process. */
1258 quit_failed
= (net_quit () == -1);
1262 /* If a net_quit () or net_wait () call has failed,
1263 allow the user to break the connection with the target.
1264 We can't simply error () out of this loop, since the
1265 data structures representing the state of the inferior
1266 are in an inconsistent state. */
1268 if (quit_failed
|| net_wait (&rdbEvent
) == -1)
1271 if (query ("Can't %s. Disconnect from target system? ",
1272 (quit_failed
) ? "suspend remote task"
1273 : "get status of remote task"))
1275 target_mourn_inferior();
1276 error ("Use the \"target\" command to reconnect.");
1280 terminal_inferior ();
1285 pid
= rdbEvent
.taskId
;
1288 sleep_ms (200); /* FIXME Don't kill the network too badly */
1290 else if (pid
!= inferior_pid
)
1291 fatal ("Bad pid for debugged task: 0x%x\n", pid
);
1294 /* FIXME, eventually do more then SIGTRAP on everything... */
1295 switch (rdbEvent
.eventType
)
1299 /* FIXME is it possible to distinguish between a
1300 XXX normal vs abnormal exit in VxWorks? */
1303 case EVENT_START
: /* Task was just started. */
1304 WSETSTOP (w
, SIGTRAP
);
1308 WSETSTOP (w
, SIGTRAP
);
1309 /* XXX was it stopped by a signal? act accordingly */
1312 case EVENT_BREAK
: /* Breakpoint was hit. */
1313 WSETSTOP (w
, SIGTRAP
);
1316 case EVENT_SUSPEND
: /* Task was suspended, probably by ^C. */
1317 WSETSTOP (w
, SIGINT
);
1320 case EVENT_BUS_ERR
: /* Task made evil nasty reference. */
1321 WSETSTOP (w
, SIGBUS
);
1324 case EVENT_ZERO_DIV
: /* Division by zero */
1325 WSETSTOP (w
, SIGFPE
); /* Like Unix, call it a float exception. */
1328 /* The target is not running Unix, and its
1329 faults/traces do not map nicely into Unix signals.
1330 Make sure they do not get confused with Unix signals
1331 by numbering them with values higher than the highest
1332 legal Unix signal. code in the arch-dependent PRINT_RANDOM_SIGNAL
1333 routine will interpret the value for wait_for_inferior. */
1334 WSETSTOP (w
, rdbEvent
.sigType
+ NSIG
);
1337 *status
= *(int *)&w
; /* Grumble union wait crap Grumble */
1345 char *bootFile
= (char *)arg
;
1346 symbol_file_command (bootFile
, 0);
1351 add_symbol_stub (arg
)
1354 struct ldfile
*pLoadFile
= (struct ldfile
*)arg
;
1356 printf("\t%s: ", pLoadFile
->name
);
1357 symbol_file_add (pLoadFile
->name
, 0, pLoadFile
->txt_addr
, 0);
1361 /* Target command for VxWorks target systems.
1363 Used in vxgdb. Takes the name of a remote target machine
1364 running vxWorks and connects to it to initialize remote network
1368 vx_open (args
, from_tty
)
1372 extern int close ();
1374 extern char *source_path
;
1375 struct ldtabl loadTable
;
1376 struct ldfile
*pLoadFile
;
1378 extern CLIENT
*pClient
;
1381 error_no_arg ("target machine name");
1383 target_preopen (from_tty
);
1385 unpush_target (&vx_ops
);
1386 printf ("Attaching remote machine across net...\n");
1389 /* Allow the user to kill the connect attempt by typing ^C.
1390 Wait until the call to target_has_fp () completes before
1391 disallowing an immediate quit, since even if net_connect ()
1392 is successful, the remote debug server might be hung. */
1397 target_has_fp
= net_check_for_fp ();
1398 printf_filtered ("Connected to %s.\n", args
);
1402 push_target (&vx_ops
);
1404 /* Save a copy of the target host's name. */
1405 vx_host
= savestring (args
, strlen (args
));
1407 /* Find out the name of the file from which the target was booted
1408 and load its symbol table. */
1410 printf_filtered ("Looking in Unix path for all loaded modules:\n");
1412 if (!net_get_boot_file (&bootFile
))
1415 printf_filtered ("\t%s: ", bootFile
);
1416 if (catch_errors (symbol_stub
, (int)bootFile
,
1417 "Error reading symbols from boot file"))
1418 puts_filtered ("ok\n");
1419 } else if (from_tty
)
1420 printf ("VxWorks kernel symbols not loaded.\n");
1423 error ("Can't retrieve boot file name from target machine.");
1425 clnt_freeres (pClient
, xdr_wrapstring
, &bootFile
);
1427 if (net_get_symbols (&loadTable
) != 0)
1428 error ("Can't read loaded modules from target machine");
1431 while (++i
< loadTable
.tbl_size
)
1433 QUIT
; /* FIXME, avoids clnt_freeres below: mem leak */
1434 pLoadFile
= &loadTable
.tbl_ent
[i
];
1438 struct cleanup
*old_chain
;
1439 char *fullname
= NULL
;
1441 desc
= openp (source_path
, 0, pLoadFile
->name
, O_RDONLY
, 0, &fullname
);
1443 perror_with_name (pLoadFile
->name
);
1444 old_chain
= make_cleanup (close
, desc
);
1445 add_file_at_addr (fullname
, desc
, pLoadFile
->txt_addr
, pLoadFile
->data_addr
,
1446 pLoadFile
->bss_addr
);
1447 do_cleanups (old_chain
);
1451 (1) Searches the PATH, not the source path.
1452 (2) data and bss are assumed to be at the usual offsets from text. */
1453 catch_errors (add_symbol_stub
, (int)pLoadFile
, (char *)0);
1456 printf_filtered ("Done.\n");
1458 clnt_freeres (pClient
, xdr_ldtabl
, &loadTable
);
1461 /* attach_command --
1462 takes a task started up outside of gdb and ``attaches'' to it.
1463 This stops it cold in its tracks and allows us to start tracing it. */
1466 vx_attach (args
, from_tty
)
1473 Ptrace_return ptrace_out
;
1479 error_no_arg ("process-id to attach");
1481 pid
= strtol (args
, &cptr
, 0);
1482 if ((cptr
== args
) || (*cptr
!= '\0'))
1483 error ("Invalid process-id -- give a single number in decimal or 0xhex");
1486 printf ("Attaching pid 0x%x.\n", pid
);
1488 bzero ((char *)&ptrace_in
, sizeof (ptrace_in
));
1489 bzero ((char *)&ptrace_out
, sizeof (ptrace_out
));
1490 ptrace_in
.pid
= pid
;
1492 status
= net_ptrace_clnt_call (PTRACE_ATTACH
, &ptrace_in
, &ptrace_out
);
1495 if (ptrace_out
.status
== -1)
1497 errno
= ptrace_out
.errno
;
1498 perror_with_name ("Attaching remote process");
1502 push_target (&vx_run_ops
);
1506 #if defined (START_INFERIOR_HOOK)
1507 START_INFERIOR_HOOK ();
1510 mark_breakpoints_out ();
1512 /* Set up the "saved terminal modes" of the inferior
1513 based on what modes we are starting it with. */
1514 target_terminal_init ();
1516 /* Install inferior's terminal modes. */
1517 target_terminal_inferior ();
1519 /* We will get a task spawn event immediately. */
1520 init_wait_for_inferior ();
1521 clear_proceed_status ();
1522 stop_soon_quietly
= 1;
1523 wait_for_inferior ();
1524 stop_soon_quietly
= 0;
1529 /* detach_command --
1530 takes a program previously attached to and detaches it.
1531 The program resumes execution and will no longer stop
1532 on signals, etc. We better not have left any breakpoints
1533 in the program or it'll die when it hits one. For this
1534 to work, it may be necessary for the process to have been
1535 previously attached. It *might* work if the program was
1536 started via the normal ptrace (PTRACE_TRACEME). */
1539 vx_detach (args
, from_tty
)
1544 Ptrace_return ptrace_out
;
1549 error ("Argument given to VxWorks \"detach\".");
1552 printf ("Detaching pid 0x%x.\n", inferior_pid
);
1554 if (args
) /* FIXME, should be possible to leave suspended */
1555 signal
= atoi (args
);
1557 bzero ((char *)&ptrace_in
, sizeof (ptrace_in
));
1558 bzero ((char *)&ptrace_out
, sizeof (ptrace_out
));
1559 ptrace_in
.pid
= inferior_pid
;
1561 status
= net_ptrace_clnt_call (PTRACE_DETACH
, &ptrace_in
, &ptrace_out
);
1564 if (ptrace_out
.status
== -1)
1566 errno
= ptrace_out
.errno
;
1567 perror_with_name ("Detaching VxWorks process");
1571 pop_target (); /* go back to non-executing VxWorks connection */
1574 /* vx_kill -- takes a running task and wipes it out. */
1577 vx_kill (args
, from_tty
)
1582 Ptrace_return ptrace_out
;
1586 error ("Argument given to VxWorks \"kill\".");
1589 printf ("Killing pid 0x%x.\n", inferior_pid
);
1591 bzero ((char *)&ptrace_in
, sizeof (ptrace_in
));
1592 bzero ((char *)&ptrace_out
, sizeof (ptrace_out
));
1593 ptrace_in
.pid
= inferior_pid
;
1595 status
= net_ptrace_clnt_call (PTRACE_KILL
, &ptrace_in
, &ptrace_out
);
1598 if (ptrace_out
.status
== -1)
1600 errno
= ptrace_out
.errno
;
1601 perror_with_name ("Killing VxWorks process");
1604 /* If it gives good status, the process is *gone*, no events remain. */
1606 pop_target (); /* go back to non-executing VxWorks connection */
1609 /* Clean up from the VxWorks process target as it goes away. */
1612 vx_proc_close (quitting
)
1615 inferior_pid
= 0; /* No longer have a process. */
1621 /* Cross-net conversion of floats to and from extended form.
1622 (This is needed because different target machines have different
1623 extended floating point formats.) */
1625 /* Convert from an extended float to a double.
1627 The extended float is stored as raw data pointed to by FROM.
1628 Return the converted value as raw data in the double pointed to by TO.
1632 vx_convert_to_virtual (regno
, from
, to
)
1637 enum clnt_stat status
;
1639 if (REGISTER_CONVERTIBLE (regno
))
1641 if (!target_has_fp
) {
1642 *(double *)to
= 0.0; /* Skip the trouble if no float anyway */
1646 status
= net_clnt_call (VX_CONV_FROM_68881
, xdr_ext_fp
, from
,
1649 if (status
== RPC_SUCCESS
)
1655 bcopy (from
, to
, REGISTER_VIRTUAL_SIZE (regno
));
1659 /* The converse: convert from a double to an extended float.
1661 The double is stored as raw data pointed to by FROM.
1662 Return the converted value as raw data in the extended
1663 float pointed to by TO.
1667 vx_convert_from_virtual (regno
, from
, to
)
1672 enum clnt_stat status
;
1674 if (REGISTER_CONVERTIBLE (regno
))
1676 if (!target_has_fp
) {
1677 bzero (to
, REGISTER_RAW_SIZE (FP0_REGNUM
)); /* Shrug */
1681 status
= net_clnt_call (VX_CONV_TO_68881
, xdr_double
, from
,
1683 if (status
== RPC_SUCCESS
)
1689 bcopy (from
, to
, REGISTER_VIRTUAL_SIZE (regno
));
1692 /* Make an RPC call to the VxWorks target.
1693 Returns RPC status. */
1695 static enum clnt_stat
1696 net_clnt_call (procNum
, inProc
, in
, outProc
, out
)
1697 enum ptracereq procNum
;
1703 enum clnt_stat status
;
1705 status
= clnt_call (pClient
, procNum
, inProc
, in
, outProc
, out
, rpcTimeout
);
1707 if (status
!= RPC_SUCCESS
)
1708 clnt_perrno (status
);
1713 /* Clean up before losing control. */
1720 clnt_destroy (pClient
); /* The net connection */
1724 free (vx_host
); /* The hostname */
1728 /* A vxprocess target should be started via "run" not "target". */
1731 vx_proc_open (name
, from_tty
)
1735 error ("Use the \"run\" command to start a VxWorks process.");
1738 /* Target ops structure for accessing memory and such over the net */
1740 struct target_ops vx_ops
= {
1741 "vxworks", "VxWorks target memory via RPC over TCP/IP",
1742 "Use VxWorks target memory. \n\
1743 Specify the name of the machine to connect to.",
1744 vx_open
, vx_close
, vx_attach
, 0, /* vx_detach, */
1745 0, 0, /* resume, wait */
1746 0, 0, /* read_reg, write_reg */
1747 0, vx_convert_to_virtual
, vx_convert_from_virtual
, /* prep_to_store, */
1748 vx_xfer_memory
, vx_files_info
,
1749 0, 0, /* insert_breakpoint, remove_breakpoint */
1750 0, 0, 0, 0, 0, /* terminal stuff */
1753 0, /* call_function */
1755 vx_create_inferior
, 0, /* mourn_inferior */
1756 core_stratum
, 0, /* next */
1757 1, 1, 0, 0, 0, /* all mem, mem, stack, regs, exec */
1758 0, 0, /* Section pointers */
1759 OPS_MAGIC
, /* Always the last thing */
1762 /* Target ops structure for accessing VxWorks child processes over the net */
1764 struct target_ops vx_run_ops
= {
1765 "vxprocess", "VxWorks process",
1766 "VxWorks process, started by the \"run\" command.",
1767 vx_proc_open
, vx_proc_close
, 0, vx_detach
, /* vx_attach */
1769 vx_read_register
, vx_write_register
,
1770 vx_prepare_to_store
, vx_convert_to_virtual
, vx_convert_from_virtual
,
1771 vx_xfer_memory
, vx_run_files_info
,
1772 vx_insert_breakpoint
, vx_remove_breakpoint
,
1773 0, 0, 0, 0, 0, /* terminal stuff */
1776 call_function_by_hand
, /* FIXME, calling fns is maybe botched? */
1778 0, vx_mourn_inferior
,
1779 process_stratum
, 0, /* next */
1780 0, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
1781 /* all_mem is off to avoid spurious msg in "i files" */
1782 0, 0, /* Section pointers */
1783 OPS_MAGIC
, /* Always the last thing */
1785 /* ==> Remember when reading at end of file, there are two "ops" structs here. */
1790 add_target (&vx_ops
);
1791 add_target (&vx_run_ops
);