static int
nomemory PARAMS ((CORE_ADDR, char *, int, int));
+static int
+return_zero PARAMS ((void));
+
static void
ignore PARAMS ((void));
+
static void
target_command PARAMS ((char *, int));
+static struct target_ops *
+find_default_run_target PARAMS ((char *));
+
/* Pointer to array of target architecture structures; the size of the
array; the current index into the array; the allocated size of the
array. */
current target. */
struct target_ops dummy_target = {"None", "None", "",
- 0, 0, 0, 0, /* open, close, attach, detach */
+ 0, 0, /* open, close */
+ find_default_attach, 0, /* attach, detach */
0, 0, /* resume, wait */
- 0, 0, 0, 0, 0, /* registers */
+ 0, 0, 0, /* registers */
0, 0, /* memory */
0, 0, /* bkpts */
0, 0, 0, 0, 0, /* terminal */
0, 0, /* kill, load */
0, /* lookup_symbol */
- 0, 0, /* create_inferior, mourn_inferior */
+ find_default_create_inferior, /* create_inferior */
+ 0, /* mourn_inferior */
+ 0, /* can_run */
dummy_stratum, 0, /* stratum, next */
0, 0, 0, 0, 0, /* all mem, mem, stack, regs, exec */
0, 0, /* section pointers */
char *arg;
int from_tty;
{
- fputs_filtered ("Argument required (target name).\n", stdout);
+ fputs_filtered ("Argument required (target name). Try `help target'\n",
+ stdout);
}
/* Add a possible target architecture to the list. */
de_fault (to_fetch_registers, (void (*)())ignore);
de_fault (to_store_registers, (void (*)())noprocess);
de_fault (to_prepare_to_store, (void (*)())noprocess);
- de_fault (to_convert_to_virtual, host_convert_to_virtual);
- de_fault (to_convert_from_virtual, host_convert_from_virtual);
de_fault (to_xfer_memory, (int (*)())nomemory);
de_fault (to_files_info, (void (*)())ignore);
de_fault (to_insert_breakpoint, memory_insert_breakpoint);
de_fault (to_lookup_symbol, nosymbol);
de_fault (to_create_inferior, maybe_kill_then_create_inferior);
de_fault (to_mourn_inferior, (void (*)())noprocess);
+ de_fault (to_can_run, return_zero);
de_fault (to_next, 0);
de_fault (to_has_all_memory, 0);
de_fault (to_has_memory, 0);
/* If this address is for nonexistent memory,
read zeros if reading, or do nothing if writing. Return error. */
if (!write)
- (void) memset (myaddr, 0, len);
+ memset (myaddr, 0, len);
if (errno == 0)
return EIO;
else
}
}
+/* Look through the list of possible targets for a target that can
+ execute a run or attach command without any other data. This is
+ used to locate the default process stratum.
+
+ Result is always valid (error() is called for errors). */
+
+static struct target_ops *
+find_default_run_target (do_mesg)
+ char *do_mesg;
+{
+ struct target_ops **t;
+ struct target_ops *runable;
+ int count;
+
+ count = 0;
+
+ for (t = target_structs; t < target_structs + target_struct_size;
+ ++t)
+ {
+ if (target_can_run(*t))
+ {
+ runable = *t;
+ ++count;
+ }
+ }
+
+ if (count != 1)
+ error ("Don't know how to %s. Try \"help target\".", do_mesg);
+
+ return runable;
+}
+
+void
+find_default_attach (args, from_tty)
+ char *args;
+ int from_tty;
+{
+ struct target_ops *t;
+
+ t = find_default_run_target("attach");
+ (t->to_attach) (args, from_tty);
+ return;
+}
+
+void
+find_default_create_inferior (exec_file, allargs, env)
+ char *exec_file;
+ char *allargs;
+ char **env;
+{
+ struct target_ops *t;
+
+ t = find_default_run_target("run");
+ (t->to_create_inferior) (exec_file, allargs, env);
+ return;
+}
+
+static int
+return_zero ()
+{
+ return 0;
+}
+
static char targ_desc[] =
"Names of targets and files being debugged.\n\
Shows the entire stack of targets currently in use (including the exec-file,\n\