setup_exception_port ();
xx_debug ("Now the debugged task is created\n");
+
+ /* One trap to exec the shell, one to exec the program being debugged. */
+ intercept_exec_calls (2);
}
setup_exception_port ()
There is no other way to exit this loop.
Returns the inferior_pid for rest of gdb.
- Side effects: Set unix exit value to *w.
- */
+ Side effects: Set *OURSTATUS. */
int
-mach_really_wait (w)
- WAITTYPE *w;
+mach_really_wait (ourstatus)
+ struct target_waitstatus *ourstatus;
{
int pid;
kern_return_t ret;
+ int w;
struct msg {
mach_msg_header_t header;
{
/* Collect Unix exit status for gdb */
- wait3(w, WNOHANG, 0);
+ wait3(&w, WNOHANG, 0);
/* This mess is here to check that the rest of
* gdb knows that the inferior died. It also
* has happened to it's children when mach-magic
* is applied on them.
*/
- if ((!WIFEXITED(*w) && WIFSTOPPED(*w)) ||
- (WIFEXITED(*w) && WEXITSTATUS(*w) > 0377))
+ if ((!WIFEXITED(w) && WIFSTOPPED(w)) ||
+ (WIFEXITED(w) && WEXITSTATUS(w) > 0377))
{
- WSETEXIT(*w, 0);
+ WSETEXIT(w, 0);
warning ("Using exit value 0 for terminated task");
}
- else if (!WIFEXITED(*w))
+ else if (!WIFEXITED(w))
{
- int sig = WTERMSIG(*w);
+ int sig = WTERMSIG(w);
/* Signals cause problems. Warn the user. */
if (sig != SIGKILL) /* Bad luck if garbage matches this */
warning ("The terminating signal stuff may be nonsense");
else if (sig > NSIG)
{
- WSETEXIT(*w, 0);
+ WSETEXIT(w, 0);
warning ("Using exit value 0 for terminated task");
}
}
+ store_waitstatus (ourstatus, w);
return inferior_pid;
}
}
if (stopped_in_exception)
{
/* Get unix state. May be changed in mach3_exception_actions() */
- wait3(w, WNOHANG, 0);
+ wait3(&w, WNOHANG, 0);
- mach3_exception_actions (w, FALSE, "Task");
+ mach3_exception_actions (&w, FALSE, "Task");
+ store_waitstatus (ourstatus, w);
return inferior_pid;
}
}
}
}
- bcopy ((char *)addr - low_address + copied_memory, myaddr, length);
+ memcpy (myaddr, (char *)addr - low_address + copied_memory, length);
ret = vm_deallocate (mach_task_self (),
copied_memory,
deallocate++;
- bcopy (myaddr, (char *)addr - low_address + copied_memory, length);
+ memcpy ((char *)addr - low_address + copied_memory, myaddr, length);
obstack_init (®ion_obstack);
void
print_tl_address (stream, pc)
- FILE *stream;
+ GDB_FILE *stream;
CORE_ADDR pc;
{
if (! lookup_minimal_symbol_by_pc (pc))
buf,
translate_cstate (scan->state),
wired);
- print_tl_address (stdout, kthread->pc);
+ print_tl_address (gdb_stdout, kthread->pc);
}
else
{
if (FETCH_CPROC_STATE (&state) == -1)
puts_filtered ("???");
else
- print_tl_address (stdout, state.pc);
+ print_tl_address (gdb_stdout, state.pc);
neworder++;
}
buf,
"", /* No cproc state */
""); /* Can't be wired */
- print_tl_address (stdout, their_threads[index].pc);
+ print_tl_address (gdb_stdout, their_threads[index].pc);
puts_filtered ("\n");
}
}
char *arg;
int from_tty;
{
- printf ("\"thread\" must be followed by the name of a thread command.\n");
- help_list (cmd_thread_list, "thread ", -1, stdout);
+ printf_unfiltered ("\"thread\" must be followed by the name of a thread command.\n");
+ help_list (cmd_thread_list, "thread ", -1, gdb_stdout);
}
/*ARGSUSED*/
char *arg;
int from_tty;
{
- printf ("\"task\" must be followed by the name of a task command.\n");
- help_list (cmd_task_list, "task ", -1, stdout);
+ printf_unfiltered ("\"task\" must be followed by the name of a task command.\n");
+ help_list (cmd_task_list, "task ", -1, gdb_stdout);
}
add_mach_specific_commands ()
char *allargs;
char **env;
{
- fork_inferior (exec_file, allargs, env, m3_trace_m3, m3_trace_him);
+ fork_inferior (exec_file, allargs, env, m3_trace_m3, m3_trace_him, NULL);
/* We are at the first instruction we care about. */
/* Pedal to the metal... */
proceed ((CORE_ADDR) -1, 0, 0);
m3_resume (pid, step, signal)
int pid;
int step;
- int signal;
+ enum target_signal signal;
{
kern_return_t ret;
vm_read_cache_valid = FALSE;
if (signal && inferior_pid > 0) /* Do not signal, if attached by MID */
- kill (inferior_pid, signal);
+ kill (inferior_pid, target_signal_to_host (signal));
if (step)
{
exec_file = (char *) get_exec_file (0);
if (exec_file)
- printf ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid));
+ printf_unfiltered ("Attaching to program `%s', %s\n", exec_file, target_pid_to_str (pid));
else
- printf ("Attaching to %s\n", target_pid_to_str (pid));
+ printf_unfiltered ("Attaching to %s\n", target_pid_to_str (pid));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
m3_do_attach (pid);
char *exec_file = get_exec_file (0);
if (exec_file == 0)
exec_file = "";
- printf ("Detaching from program: %s %s\n",
+ printf_unfiltered ("Detaching from program: %s %s\n",
exec_file, target_pid_to_str (inferior_pid));
- fflush (stdout);
+ gdb_flush (gdb_stdout);
}
if (args)
siggnal = atoi (args);
}
#endif /* ATTACH_DETACH */
+static void
+m3_open (arg, from_tty)
+ char *arg;
+ int from_tty;
+{
+ error ("Use the \"run\" command to start a Unix child process.");
+}
+
#ifdef DUMP_SYSCALL
#ifdef __STDC__
#define STR(x) #x
"mach", /* to_shortname */
"Mach child process", /* to_longname */
"Mach child process (started by the \"run\" command).", /* to_doc */
- ??_open, /* to_open */
+ m3_open, /* to_open */
0, /* to_close */
m3_attach, /* to_attach */
m3_detach, /* to_detach */