1 /* Generic remote debugging interface for simulators.
2 Copyright 1993, 1994, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
4 Steve Chamberlain (sac@cygnus.com).
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
27 #include "gdb_string.h"
37 #include "remote-sim.h"
38 #include "remote-utils.h"
43 extern void _initialize_remote_sim (void);
45 extern int (*ui_loop_hook) (int signo);
47 static void dump_mem (char *buf, int len);
49 static void init_callbacks (void);
51 static void end_callbacks (void);
53 static int gdb_os_write_stdout (host_callback *, const char *, int);
55 static void gdb_os_flush_stdout (host_callback *);
57 static int gdb_os_write_stderr (host_callback *, const char *, int);
59 static void gdb_os_flush_stderr (host_callback *);
61 static int gdb_os_poll_quit (host_callback *);
63 /* printf_filtered is depreciated */
64 static void gdb_os_printf_filtered (host_callback *, const char *, ...);
66 static void gdb_os_vprintf_filtered (host_callback *, const char *, va_list);
68 static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list);
70 static void gdb_os_error (host_callback *, const char *, ...);
72 static void gdbsim_fetch_register (int regno);
74 static void gdbsim_store_register (int regno);
76 static void gdbsim_kill (void);
78 static void gdbsim_load (char *prog, int fromtty);
80 static void gdbsim_create_inferior (char *exec_file, char *args, char **env);
82 static void gdbsim_open (char *args, int from_tty);
84 static void gdbsim_close (int quitting);
86 static void gdbsim_detach (char *args, int from_tty);
88 static void gdbsim_resume (int pid, int step, enum target_signal siggnal);
90 static int gdbsim_wait (int pid, struct target_waitstatus *status);
92 static void gdbsim_prepare_to_store (void);
94 static int gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr,
96 struct mem_attrib *attrib,
97 struct target_ops *target);
99 static void gdbsim_files_info (struct target_ops *target);
101 static void gdbsim_mourn_inferior (void);
103 static void gdbsim_stop (void);
105 void simulator_command (char *args, int from_tty);
107 /* Naming convention:
109 sim_* are the interface to the simulator (see remote-sim.h).
110 gdbsim_* are stuff which is internal to gdb. */
112 /* Forward data declarations */
113 extern struct target_ops gdbsim_ops;
115 static int program_loaded = 0;
117 /* We must keep track of whether the simulator has been opened or not because
118 GDB can call a target's close routine twice, but sim_close doesn't allow
119 this. We also need to record the result of sim_open so we can pass it
120 back to the other sim_foo routines. */
121 static SIM_DESC gdbsim_desc = 0;
124 dump_mem (char *buf, int len)
128 if (len == 8 || len == 4)
131 memcpy (l, buf, len);
132 printf_filtered ("\t0x%lx", l[0]);
133 printf_filtered (len == 8 ? " 0x%x\n" : "\n", l[1]);
138 printf_filtered ("\t");
139 for (i = 0; i < len; i++)
140 printf_filtered ("0x%x ", buf[i]);
141 printf_filtered ("\n");
146 static host_callback gdb_callback;
147 static int callbacks_initialized = 0;
149 /* Initialize gdb_callback. */
152 init_callbacks (void)
154 if (!callbacks_initialized)
156 gdb_callback = default_callback;
157 gdb_callback.init (&gdb_callback);
158 gdb_callback.write_stdout = gdb_os_write_stdout;
159 gdb_callback.flush_stdout = gdb_os_flush_stdout;
160 gdb_callback.write_stderr = gdb_os_write_stderr;
161 gdb_callback.flush_stderr = gdb_os_flush_stderr;
162 gdb_callback.printf_filtered = gdb_os_printf_filtered;
163 gdb_callback.vprintf_filtered = gdb_os_vprintf_filtered;
164 gdb_callback.evprintf_filtered = gdb_os_evprintf_filtered;
165 gdb_callback.error = gdb_os_error;
166 gdb_callback.poll_quit = gdb_os_poll_quit;
167 gdb_callback.magic = HOST_CALLBACK_MAGIC;
168 callbacks_initialized = 1;
172 /* Release callbacks (free resources used by them). */
177 if (callbacks_initialized)
179 gdb_callback.shutdown (&gdb_callback);
180 callbacks_initialized = 0;
184 /* GDB version of os_write_stdout callback. */
187 gdb_os_write_stdout (host_callback *p, const char *buf, int len)
192 ui_file_write (gdb_stdtarg, buf, len);
196 /* GDB version of os_flush_stdout callback. */
199 gdb_os_flush_stdout (host_callback *p)
201 gdb_flush (gdb_stdtarg);
204 /* GDB version of os_write_stderr callback. */
207 gdb_os_write_stderr (host_callback *p, const char *buf, int len)
212 for (i = 0; i < len; i++)
216 fputs_unfiltered (b, gdb_stdtarg);
221 /* GDB version of os_flush_stderr callback. */
224 gdb_os_flush_stderr (host_callback *p)
226 gdb_flush (gdb_stderr);
229 /* GDB version of printf_filtered callback. */
232 gdb_os_printf_filtered (host_callback * p, const char *format,...)
235 va_start (args, format);
237 vfprintf_filtered (gdb_stdout, format, args);
242 /* GDB version of error vprintf_filtered. */
245 gdb_os_vprintf_filtered (host_callback * p, const char *format, va_list ap)
247 vfprintf_filtered (gdb_stdout, format, ap);
250 /* GDB version of error evprintf_filtered. */
253 gdb_os_evprintf_filtered (host_callback * p, const char *format, va_list ap)
255 vfprintf_filtered (gdb_stderr, format, ap);
258 /* GDB version of error callback. */
261 gdb_os_error (host_callback * p, const char *format,...)
268 va_start (args, format);
269 verror (format, args);
275 gdbsim_fetch_register (int regno)
277 static int warn_user = 1;
280 for (regno = 0; regno < NUM_REGS; regno++)
281 gdbsim_fetch_register (regno);
283 else if (REGISTER_NAME (regno) != NULL
284 && *REGISTER_NAME (regno) != '\0')
286 char buf[MAX_REGISTER_RAW_SIZE];
288 if (REGISTER_SIM_REGNO (regno) >= 0)
289 nr_bytes = sim_fetch_register (gdbsim_desc,
290 REGISTER_SIM_REGNO (regno),
291 buf, REGISTER_RAW_SIZE (regno));
295 /* register not applicable, supply zero's */
296 memset (buf, 0, MAX_REGISTER_RAW_SIZE);
297 else if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno)
300 fprintf_unfiltered (gdb_stderr,
301 "Size of register %s (%d/%d) incorrect (%d instead of %d))",
302 REGISTER_NAME (regno),
303 regno, REGISTER_SIM_REGNO (regno),
304 nr_bytes, REGISTER_RAW_SIZE (regno));
307 supply_register (regno, buf);
310 printf_filtered ("gdbsim_fetch_register: %d", regno);
311 /* FIXME: We could print something more intelligible. */
312 dump_mem (buf, REGISTER_RAW_SIZE (regno));
319 gdbsim_store_register (int regno)
323 for (regno = 0; regno < NUM_REGS; regno++)
324 gdbsim_store_register (regno);
326 else if (REGISTER_NAME (regno) != NULL
327 && *REGISTER_NAME (regno) != '\0'
328 && REGISTER_SIM_REGNO (regno) >= 0)
330 char tmp[MAX_REGISTER_RAW_SIZE];
332 read_register_gen (regno, tmp);
333 nr_bytes = sim_store_register (gdbsim_desc,
334 REGISTER_SIM_REGNO (regno),
335 tmp, REGISTER_RAW_SIZE (regno));
336 if (nr_bytes > 0 && nr_bytes != REGISTER_RAW_SIZE (regno))
337 internal_error ("Register size different to expected");
340 printf_filtered ("gdbsim_store_register: %d", regno);
341 /* FIXME: We could print something more intelligible. */
342 dump_mem (tmp, REGISTER_RAW_SIZE (regno));
347 /* Kill the running program. This may involve closing any open files
348 and releasing other resources acquired by the simulated program. */
354 printf_filtered ("gdbsim_kill\n");
356 /* There is no need to `kill' running simulator - the simulator is
361 /* Load an executable file into the target process. This is expected to
362 not only bring new code into the target process, but also to update
363 GDB's symbol tables to match. */
366 gdbsim_load (char *prog, int fromtty)
369 printf_filtered ("gdbsim_load: prog \"%s\"\n", prog);
373 /* FIXME: We will print two messages on error.
374 Need error to either not print anything if passed NULL or need
375 another routine that doesn't take any arguments. */
376 if (sim_load (gdbsim_desc, prog, NULL, fromtty) == SIM_RC_FAIL)
377 error ("unable to load program");
379 /* FIXME: If a load command should reset the targets registers then
380 a call to sim_create_inferior() should go here. */
386 /* Start an inferior process and set inferior_pid to its pid.
387 EXEC_FILE is the file to run.
388 ARGS is a string containing the arguments to the program.
389 ENV is the environment vector to pass. Errors reported with error().
390 On VxWorks and various standalone systems, we ignore exec_file. */
391 /* This is called not only when we first attach, but also when the
392 user types "run" after having attached. */
395 gdbsim_create_inferior (char *exec_file, char *args, char **env)
398 char *arg_buf, **argv;
400 if (exec_file == 0 || exec_bfd == 0)
401 warning ("No executable file specified.");
403 warning ("No program loaded.");
406 printf_filtered ("gdbsim_create_inferior: exec_file \"%s\", args \"%s\"\n",
407 (exec_file ? exec_file : "(NULL)"),
411 remove_breakpoints ();
412 init_wait_for_inferior ();
414 if (exec_file != NULL)
416 len = strlen (exec_file) + 1 + strlen (args) + 1 + /*slop */ 10;
417 arg_buf = (char *) alloca (len);
419 strcat (arg_buf, exec_file);
420 strcat (arg_buf, " ");
421 strcat (arg_buf, args);
422 argv = buildargv (arg_buf);
423 make_cleanup_freeargv (argv);
427 sim_create_inferior (gdbsim_desc, exec_bfd, argv, env);
430 insert_breakpoints (); /* Needed to get correct instruction in cache */
432 clear_proceed_status ();
434 /* NB: Entry point already set by sim_create_inferior. */
435 proceed ((CORE_ADDR) -1, TARGET_SIGNAL_DEFAULT, 0);
438 /* The open routine takes the rest of the parameters from the command,
439 and (if successful) pushes a new target onto the stack.
440 Targets should supply this routine, if only to provide an error message. */
441 /* Called when selecting the simulator. EG: (gdb) target sim name. */
444 gdbsim_open (char *args, int from_tty)
451 printf_filtered ("gdbsim_open: args \"%s\"\n", args ? args : "(null)");
453 /* Remove current simulator if one exists. Only do this if the simulator
454 has been opened because sim_close requires it.
455 This is important because the call to push_target below will cause
456 sim_close to be called if the simulator is already open, but push_target
457 is called after sim_open! We can't move the call to push_target before
458 the call to sim_open because sim_open may invoke `error'. */
459 if (gdbsim_desc != NULL)
460 unpush_target (&gdbsim_ops);
462 len = (7 + 1 /* gdbsim */
463 + strlen (" -E little")
464 + strlen (" --architecture=xxxxxxxxxx")
465 + (args ? strlen (args) : 0)
467 arg_buf = (char *) alloca (len);
468 strcpy (arg_buf, "gdbsim"); /* 7 */
469 /* Specify the byte order for the target when it is both selectable
470 and explicitly specified by the user (not auto detected). */
471 if (TARGET_BYTE_ORDER_SELECTABLE_P
472 && !TARGET_BYTE_ORDER_AUTO)
474 switch (TARGET_BYTE_ORDER)
477 strcat (arg_buf, " -E big");
480 strcat (arg_buf, " -E little");
483 internal_error ("Value of TARGET_BYTE_ORDER unknown");
486 /* Specify the architecture of the target when it has been
487 explicitly specified */
488 if (!TARGET_ARCHITECTURE_AUTO)
490 strcat (arg_buf, " --architecture=");
491 strcat (arg_buf, TARGET_ARCHITECTURE->printable_name);
493 /* finally, any explicit args */
496 strcat (arg_buf, " "); /* 1 */
497 strcat (arg_buf, args);
499 argv = buildargv (arg_buf);
501 error ("Insufficient memory available to allocate simulator arg list.");
502 make_cleanup_freeargv (argv);
505 gdbsim_desc = sim_open (SIM_OPEN_DEBUG, &gdb_callback, exec_bfd, argv);
507 if (gdbsim_desc == 0)
508 error ("unable to create simulator instance");
510 push_target (&gdbsim_ops);
511 target_fetch_registers (-1);
512 printf_filtered ("Connected to the simulator.\n");
515 /* Does whatever cleanup is required for a target that we are no longer
516 going to be calling. Argument says whether we are quitting gdb and
517 should not get hung in case of errors, or whether we want a clean
518 termination even if it takes a while. This routine is automatically
519 always called just before a routine is popped off the target stack.
520 Closing file descriptors and freeing memory are typical things it should
522 /* Close out all files and local state before this target loses control. */
525 gdbsim_close (int quitting)
528 printf_filtered ("gdbsim_close: quitting %d\n", quitting);
532 if (gdbsim_desc != NULL)
534 sim_close (gdbsim_desc, quitting);
539 generic_mourn_inferior ();
542 /* Takes a program previously attached to and detaches it.
543 The program may resume execution (some targets do, some don't) and will
544 no longer stop on signals, etc. We better not have left any breakpoints
545 in the program or it'll die when it hits one. ARGS is arguments
546 typed by the user (e.g. a signal to send the process). FROM_TTY
547 says whether to be verbose or not. */
548 /* Terminate the open connection to the remote debugger.
549 Use this when you want to detach and do something else with your gdb. */
552 gdbsim_detach (char *args, int from_tty)
555 printf_filtered ("gdbsim_detach: args \"%s\"\n", args);
557 pop_target (); /* calls gdbsim_close to do the real work */
559 printf_filtered ("Ending simulator %s debugging\n", target_shortname);
562 /* Resume execution of the target process. STEP says whether to single-step
563 or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
564 to the target, or zero for no signal. */
566 static enum target_signal resume_siggnal;
567 static int resume_step;
570 gdbsim_resume (int pid, int step, enum target_signal siggnal)
572 if (inferior_pid != 42)
573 error ("The program is not being run.");
576 printf_filtered ("gdbsim_resume: step %d, signal %d\n", step, siggnal);
578 resume_siggnal = siggnal;
582 /* Notify the simulator of an asynchronous request to stop.
584 The simulator shall ensure that the stop request is eventually
585 delivered to the simulator. If the call is made while the
586 simulator is not running then the stop request is processed when
587 the simulator is next resumed.
589 For simulators that do not support this operation, just abort */
594 if (!sim_stop (gdbsim_desc))
600 /* GDB version of os_poll_quit callback.
601 Taken from gdb/util.c - should be in a library */
604 gdb_os_poll_quit (host_callback *p)
606 if (ui_loop_hook != NULL)
610 if (quit_flag) /* gdb's idea of quit */
612 quit_flag = 0; /* we've stolen it */
615 else if (immediate_quit)
622 /* Wait for inferior process to do something. Return pid of child,
623 or -1 in case of error; store status through argument pointer STATUS,
624 just as `wait' would. */
627 gdbsim_cntrl_c (int signo)
633 gdbsim_wait (int pid, struct target_waitstatus *status)
635 static RETSIGTYPE (*prev_sigint) ();
637 enum sim_stop reason = sim_running;
640 printf_filtered ("gdbsim_wait\n");
642 #if defined (HAVE_SIGACTION) && defined (SA_RESTART)
644 struct sigaction sa, osa;
645 sa.sa_handler = gdbsim_cntrl_c;
646 sigemptyset (&sa.sa_mask);
648 sigaction (SIGINT, &sa, &osa);
649 prev_sigint = osa.sa_handler;
652 prev_sigint = signal (SIGINT, gdbsim_cntrl_c);
654 sim_resume (gdbsim_desc, resume_step,
655 target_signal_to_host (resume_siggnal));
656 signal (SIGINT, prev_sigint);
659 sim_stop_reason (gdbsim_desc, &reason, &sigrc);
664 status->kind = TARGET_WAITKIND_EXITED;
665 status->value.integer = sigrc;
676 status->kind = TARGET_WAITKIND_STOPPED;
677 /* The signal in sigrc is a host signal. That probably
679 status->value.sig = target_signal_from_host (sigrc);
684 status->kind = TARGET_WAITKIND_SIGNALLED;
685 /* The signal in sigrc is a host signal. That probably
687 status->value.sig = target_signal_from_host (sigrc);
691 /* FIXME: Is this correct? */
698 /* Get ready to modify the registers array. On machines which store
699 individual registers, this doesn't need to do anything. On machines
700 which store all the registers in one fell swoop, this makes sure
701 that registers contains all the registers from the program being
705 gdbsim_prepare_to_store (void)
707 /* Do nothing, since we can store individual regs */
710 /* Transfer LEN bytes between GDB address MYADDR and target address
711 MEMADDR. If WRITE is non-zero, transfer them to the target,
712 otherwise transfer them from the target. TARGET is unused.
714 Returns the number of bytes transferred. */
717 gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
719 struct mem_attrib *attrib ATTRIBUTE_UNUSED,
720 struct target_ops *target ATTRIBUTE_UNUSED)
723 error ("No program loaded.");
727 /* FIXME: Send to something other than STDOUT? */
728 printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
729 gdb_print_host_address (myaddr, gdb_stdout);
730 printf_filtered (", memaddr 0x%s, len %d, write %d\n",
731 paddr_nz (memaddr), len, write);
732 if (sr_get_debug () && write)
733 dump_mem (myaddr, len);
738 len = sim_write (gdbsim_desc, memaddr, myaddr, len);
742 len = sim_read (gdbsim_desc, memaddr, myaddr, len);
743 if (sr_get_debug () && len > 0)
744 dump_mem (myaddr, len);
750 gdbsim_files_info (struct target_ops *target)
752 char *file = "nothing";
755 file = bfd_get_filename (exec_bfd);
758 printf_filtered ("gdbsim_files_info: file \"%s\"\n", file);
762 printf_filtered ("\tAttached to %s running program %s\n",
763 target_shortname, file);
764 sim_info (gdbsim_desc, 0);
768 /* Clear the simulator's notion of what the break points are. */
771 gdbsim_mourn_inferior (void)
774 printf_filtered ("gdbsim_mourn_inferior:\n");
776 remove_breakpoints ();
777 generic_mourn_inferior ();
781 gdbsim_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
783 #ifdef SIM_HAS_BREAKPOINTS
786 retcode = sim_set_breakpoint (gdbsim_desc, addr);
792 case SIM_RC_INSUFFICIENT_RESOURCES:
798 return memory_insert_breakpoint (addr, contents_cache);
803 gdbsim_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
805 #ifdef SIM_HAS_BREAKPOINTS
808 retcode = sim_clear_breakpoint (gdbsim_desc, addr);
813 case SIM_RC_UNKNOWN_BREAKPOINT:
815 case SIM_RC_INSUFFICIENT_RESOURCES:
821 return memory_remove_breakpoint (addr, contents_cache);
825 /* Pass the command argument through to the simulator verbatim. The
826 simulator must do any command interpretation work. */
829 simulator_command (char *args, int from_tty)
831 if (gdbsim_desc == NULL)
834 /* PREVIOUSLY: The user may give a command before the simulator
835 is opened. [...] (??? assuming of course one wishes to
836 continue to allow commands to be sent to unopened simulators,
837 which isn't entirely unreasonable). */
839 /* The simulator is a builtin abstraction of a remote target.
840 Consistent with that model, access to the simulator, via sim
841 commands, is restricted to the period when the channel to the
842 simulator is open. */
844 error ("Not connected to the simulator target");
847 sim_do_command (gdbsim_desc, args);
849 /* Invalidate the register cache, in case the simulator command does
851 registers_changed ();
854 /* Define the target subroutine names */
856 struct target_ops gdbsim_ops;
859 init_gdbsim_ops (void)
861 gdbsim_ops.to_shortname = "sim";
862 gdbsim_ops.to_longname = "simulator";
863 gdbsim_ops.to_doc = "Use the compiled-in simulator.";
864 gdbsim_ops.to_open = gdbsim_open;
865 gdbsim_ops.to_close = gdbsim_close;
866 gdbsim_ops.to_attach = NULL;
867 gdbsim_ops.to_post_attach = NULL;
868 gdbsim_ops.to_require_attach = NULL;
869 gdbsim_ops.to_detach = gdbsim_detach;
870 gdbsim_ops.to_require_detach = NULL;
871 gdbsim_ops.to_resume = gdbsim_resume;
872 gdbsim_ops.to_wait = gdbsim_wait;
873 gdbsim_ops.to_post_wait = NULL;
874 gdbsim_ops.to_fetch_registers = gdbsim_fetch_register;
875 gdbsim_ops.to_store_registers = gdbsim_store_register;
876 gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store;
877 gdbsim_ops.to_xfer_memory = gdbsim_xfer_inferior_memory;
878 gdbsim_ops.to_files_info = gdbsim_files_info;
879 gdbsim_ops.to_insert_breakpoint = gdbsim_insert_breakpoint;
880 gdbsim_ops.to_remove_breakpoint = gdbsim_remove_breakpoint;
881 gdbsim_ops.to_terminal_init = NULL;
882 gdbsim_ops.to_terminal_inferior = NULL;
883 gdbsim_ops.to_terminal_ours_for_output = NULL;
884 gdbsim_ops.to_terminal_ours = NULL;
885 gdbsim_ops.to_terminal_info = NULL;
886 gdbsim_ops.to_kill = gdbsim_kill;
887 gdbsim_ops.to_load = gdbsim_load;
888 gdbsim_ops.to_lookup_symbol = NULL;
889 gdbsim_ops.to_create_inferior = gdbsim_create_inferior;
890 gdbsim_ops.to_post_startup_inferior = NULL;
891 gdbsim_ops.to_acknowledge_created_inferior = NULL;
892 gdbsim_ops.to_clone_and_follow_inferior = NULL;
893 gdbsim_ops.to_post_follow_inferior_by_clone = NULL;
894 gdbsim_ops.to_insert_fork_catchpoint = NULL;
895 gdbsim_ops.to_remove_fork_catchpoint = NULL;
896 gdbsim_ops.to_insert_vfork_catchpoint = NULL;
897 gdbsim_ops.to_remove_vfork_catchpoint = NULL;
898 gdbsim_ops.to_has_forked = NULL;
899 gdbsim_ops.to_has_vforked = NULL;
900 gdbsim_ops.to_can_follow_vfork_prior_to_exec = NULL;
901 gdbsim_ops.to_post_follow_vfork = NULL;
902 gdbsim_ops.to_insert_exec_catchpoint = NULL;
903 gdbsim_ops.to_remove_exec_catchpoint = NULL;
904 gdbsim_ops.to_has_execd = NULL;
905 gdbsim_ops.to_reported_exec_events_per_exec_call = NULL;
906 gdbsim_ops.to_has_exited = NULL;
907 gdbsim_ops.to_mourn_inferior = gdbsim_mourn_inferior;
908 gdbsim_ops.to_can_run = 0;
909 gdbsim_ops.to_notice_signals = 0;
910 gdbsim_ops.to_thread_alive = 0;
911 gdbsim_ops.to_stop = gdbsim_stop;
912 gdbsim_ops.to_pid_to_exec_file = NULL;
913 gdbsim_ops.to_core_file_to_sym_file = NULL;
914 gdbsim_ops.to_stratum = process_stratum;
915 gdbsim_ops.DONT_USE = NULL;
916 gdbsim_ops.to_has_all_memory = 1;
917 gdbsim_ops.to_has_memory = 1;
918 gdbsim_ops.to_has_stack = 1;
919 gdbsim_ops.to_has_registers = 1;
920 gdbsim_ops.to_has_execution = 1;
921 gdbsim_ops.to_sections = NULL;
922 gdbsim_ops.to_sections_end = NULL;
923 gdbsim_ops.to_magic = OPS_MAGIC;
925 #ifdef TARGET_REDEFINE_DEFAULT_OPS
926 TARGET_REDEFINE_DEFAULT_OPS (&gdbsim_ops);
931 _initialize_remote_sim (void)
934 add_target (&gdbsim_ops);
936 add_com ("sim <command>", class_obscure, simulator_command,
937 "Send a command to the simulator.");