+static VEC (char_ptr) *
+sim_command_completer (struct cmd_list_element *ignore, const char *text,
+ const char *word)
+{
+ struct sim_inferior_data *sim_data;
+ char **tmp;
+ int i;
+ VEC (char_ptr) *result = NULL;
+
+ sim_data = ((struct sim_inferior_data *)
+ inferior_data (current_inferior (), sim_inferior_data_key));
+ if (sim_data == NULL || sim_data->gdbsim_desc == NULL)
+ return NULL;
+
+ tmp = sim_complete_command (sim_data->gdbsim_desc, text, word);
+ if (tmp == NULL)
+ return NULL;
+
+ /* Transform the array into a VEC, and then free the array. */
+ for (i = 0; tmp[i] != NULL; i++)
+ VEC_safe_push (char_ptr, result, tmp[i]);
+ xfree (tmp);
+
+ return result;
+}
+
+/* Check to see if a thread is still alive. */
+
+static int
+gdbsim_thread_alive (struct target_ops *ops, ptid_t ptid)
+{
+ struct sim_inferior_data *sim_data
+ = get_sim_inferior_data_by_ptid (ptid, SIM_INSTANCE_NOT_NEEDED);
+
+ if (sim_data == NULL)
+ return 0;
+
+ if (ptid_equal (ptid, sim_data->remote_sim_ptid))
+ /* The simulators' task is always alive. */
+ return 1;
+
+ return 0;
+}
+
+/* Convert a thread ID to a string. Returns the string in a static
+ buffer. */
+
+static char *
+gdbsim_pid_to_str (struct target_ops *ops, ptid_t ptid)
+{
+ return normal_pid_to_str (ptid);
+}
+
+/* Simulator memory may be accessed after the program has been loaded. */
+
+static int
+gdbsim_has_all_memory (struct target_ops *ops)
+{
+ struct sim_inferior_data *sim_data
+ = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
+
+ if (!sim_data->program_loaded)
+ return 0;
+
+ return 1;
+}
+
+static int
+gdbsim_has_memory (struct target_ops *ops)
+{
+ struct sim_inferior_data *sim_data
+ = get_sim_inferior_data (current_inferior (), SIM_INSTANCE_NOT_NEEDED);
+
+ if (!sim_data->program_loaded)
+ return 0;
+
+ return 1;
+}
+
+/* Define the target subroutine names. */