/* Generic remote debugging interface for simulators.
- Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1993-2002, 2004-2012 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Steve Chamberlain (sac@cygnus.com).
}
else
argv = NULL;
- sim_create_inferior (sim_data->gdbsim_desc, exec_bfd, argv, env);
+
+ if (sim_create_inferior (sim_data->gdbsim_desc, exec_bfd, argv, env)
+ != SIM_RC_OK)
+ error (_("Unable to create sim inferior."));
inferior_ptid = sim_data->remote_sim_ptid;
inferior_appeared (current_inferior (), ptid_get_pid (inferior_ptid));
len = (7 + 1 /* gdbsim */
+ strlen (" -E little")
+ strlen (" --architecture=xxxxxxxxxx")
+ + strlen (" --sysroot=") + strlen (gdb_sysroot) +
+ (args ? strlen (args) : 0)
+ 50) /* slack */ ;
arg_buf = (char *) alloca (len);
strcat (arg_buf, " --architecture=");
strcat (arg_buf, selected_architecture_name ());
}
+ /* Pass along gdb's concept of the sysroot. */
+ strcat (arg_buf, " --sysroot=");
+ strcat (arg_buf, gdb_sysroot);
/* finally, any explicit args */
if (args)
{
registers_changed ();
}
+static char **
+sim_command_completer (struct cmd_list_element *ignore, char *text, char *word)
+{
+ struct sim_inferior_data *sim_data;
+
+ sim_data = inferior_data (current_inferior (), sim_inferior_data_key);
+ if (sim_data == NULL || sim_data->gdbsim_desc == NULL)
+ return NULL;
+
+ return sim_complete_command (sim_data->gdbsim_desc, text, word);
+}
+
/* Check to see if a thread is still alive. */
static int
/* Simulator memory may be accessed after the program has been loaded. */
-int
+static int
gdbsim_has_all_memory (struct target_ops *ops)
{
struct sim_inferior_data *sim_data
return 1;
}
-int
+static int
gdbsim_has_memory (struct target_ops *ops)
{
struct sim_inferior_data *sim_data
void
_initialize_remote_sim (void)
{
+ struct cmd_list_element *c;
+
init_gdbsim_ops ();
add_target (&gdbsim_ops);
- add_com ("sim", class_obscure, simulator_command,
- _("Send a command to the simulator."));
+ c = add_com ("sim", class_obscure, simulator_command,
+ _("Send a command to the simulator."));
+ set_cmd_completer (c, sim_command_completer);
sim_inferior_data_key
= register_inferior_data_with_cleanup (sim_inferior_data_cleanup);