/* Interface GDB to the GNU Hurd.
- Copyright (C) 1992, 95, 96, 97, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000
+ Free Software Foundation, Inc.
This file is part of GDB.
Boston, MA 02111-1307, USA.
*/
-#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <setjmp.h>
#include "gdbcmd.h"
#include "gdbcore.h"
#include "gdbthread.h"
+#include "gdb_assert.h"
#include "gnu-nat.h"
if (proc->sc == 0 && proc->state_changed)
/* Since PROC may start running, we must write back any state changes. */
{
- assert (proc_is_thread (proc));
+ gdb_assert (proc_is_thread (proc));
proc_debug (proc, "storing back changed thread state");
err = thread_set_state (proc->port, THREAD_STATE_FLAVOR,
(thread_state_t) &proc->state, THREAD_STATE_SIZE);
void
proc_abort (struct proc *proc, int force)
{
- assert (proc_is_thread (proc));
+ gdb_assert (proc_is_thread (proc));
if (!proc->aborted)
{
{
error_t err;
mach_port_t prev_port = MACH_PORT_NULL;
- struct proc *proc = malloc (sizeof (struct proc));
+ struct proc *proc = xmalloc (sizeof (struct proc));
proc->port = port;
proc->tid = tid;
mach_port_deallocate (mach_task_self (), proc->port);
}
- free (proc);
+ xfree (proc);
return next;
}
\f
struct inf *
-make_inf ()
+make_inf (void)
{
- struct inf *inf = malloc (sizeof (struct inf));
-
- if (!inf)
- return 0;
+ struct inf *inf = xmalloc (sizeof (struct inf));
inf->task = 0;
inf->threads = 0;
void
inf_set_step_thread (struct inf *inf, struct proc *thread)
{
- assert (!thread || proc_is_thread (thread));
+ gdb_assert (!thread || proc_is_thread (thread));
if (thread)
inf_debug (inf, "setting step thread: %d/%d", inf->pid, thread->tid);
extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
extern int process_reply_server (mach_msg_header_t *, mach_msg_header_t *);
- assert (inf->task);
+ gdb_assert (inf->task);
if (!inf->threads && !inf->pending_execs)
/* No threads! Assume that maybe some outside agency is frobbing our
{
if (thread->exc_port == port)
{
- inf_debug (waiting_inf, "Handler is thread exeption port <%d>",
+ inf_debug (waiting_inf, "Handler is thread exception port <%d>",
thread->saved_exc_port);
inf->wait.exc.handler = thread->saved_exc_port;
}
else
{
- inf_debug (waiting_inf, "Handler is task exeption port <%d>",
+ inf_debug (waiting_inf, "Handler is task exception port <%d>",
inf->task->saved_exc_port);
inf->wait.exc.handler = inf->task->saved_exc_port;
- assert (inf->task->exc_port == port);
+ gdb_assert (inf->task->exc_port == port);
}
if (inf->wait.exc.handler != MACH_PORT_NULL)
/* Add a reference to the exception handler. */
\f
static void
-gnu_kill_inferior ()
+gnu_kill_inferior (void)
{
struct proc *task = current_inferior->task;
if (task)
/* Clean up after the inferior dies. */
static void
-gnu_mourn_inferior ()
+gnu_mourn_inferior (void)
{
inf_debug (current_inferior, "rip");
inf_detach (current_inferior);
/* Set INFERIOR_PID to the first thread available in the child, if any. */
static int
-inf_pick_first_thread ()
+inf_pick_first_thread (void)
{
if (current_inferior->task && current_inferior->threads)
/* The first thread. */
}
static struct inf *
-cur_inf ()
+cur_inf (void)
{
if (!current_inferior)
current_inferior = make_inf ();
}
static void
-gnu_create_inferior (exec_file, allargs, env)
- char *exec_file;
- char *allargs;
- char **env;
+gnu_create_inferior (char *exec_file, char *allargs, char **env)
{
struct inf *inf = cur_inf ();
/* Mark our target-struct as eligible for stray "run" and "attach"
commands. */
static int
-gnu_can_run ()
+gnu_can_run (void)
{
return 1;
}
/* Attach to process PID, then initialize for debugging it
and wait for the trace-trap that results from attaching. */
static void
-gnu_attach (args, from_tty)
- char *args;
- int from_tty;
+gnu_attach (char *args, int from_tty)
{
int pid;
char *exec_file;
previously attached. It *might* work if the program was
started via fork. */
static void
-gnu_detach (args, from_tty)
- char *args;
- int from_tty;
+gnu_detach (char *args, int from_tty)
{
if (from_tty)
{
\f
static void
-gnu_terminal_init_inferior ()
+gnu_terminal_init_inferior (void)
{
- assert (current_inferior);
+ gdb_assert (current_inferior);
terminal_init_inferior_with_pgrp (current_inferior->pid);
}
that registers contains all the registers from the program being
debugged. */
static void
-gnu_prepare_to_store ()
+gnu_prepare_to_store (void)
{
#ifdef CHILD_PREPARE_TO_STORE
CHILD_PREPARE_TO_STORE ();
}
static void
-gnu_open (arg, from_tty)
- char *arg;
- int from_tty;
+gnu_open (char *arg, int from_tty)
{
error ("Use the \"run\" command to start a Unix child process.");
}
static void
-gnu_stop ()
+gnu_stop (void)
{
error ("to_stop target function not implemented");
}
static char *
-gnu_pid_to_exec_file ()
+gnu_pid_to_exec_file (void)
{
error ("to_pid_to_exec_file target function not implemented");
return NULL;
gdb's address space. Return 0 on failure; number of bytes read
otherwise. */
int
-gnu_read_inferior (task, addr, myaddr, length)
- task_t task;
- CORE_ADDR addr;
- char *myaddr;
- int length;
+gnu_read_inferior (task_t task, CORE_ADDR addr, char *myaddr, int length)
{
error_t err;
vm_address_t low_address = (vm_address_t) trunc_page (addr);
/* Write gdb's LEN bytes from MYADDR and copy it to ADDR in inferior
task's address space. */
int
-gnu_write_inferior (task, addr, myaddr, length)
- task_t task;
- CORE_ADDR addr;
- char *myaddr;
- int length;
+gnu_write_inferior (task_t task, CORE_ADDR addr, char *myaddr, int length)
{
error_t err = 0;
vm_address_t low_address = (vm_address_t) trunc_page (addr);
}
\f
-/* Return 0 on failure, number of bytes handled otherwise. */
+/* Return 0 on failure, number of bytes handled otherwise. TARGET
+ is ignored. */
static int
-gnu_xfer_memory (memaddr, myaddr, len, write, target)
- CORE_ADDR memaddr;
- char *myaddr;
- int len;
- int write;
- struct target_ops *target; /* IGNORED */
+gnu_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+ struct mem_attrib *attrib,
+ struct target_ops *target)
{
task_t task = (current_inferior
? (current_inferior->task
/* Returns the alive thread named by INFERIOR_PID, or signals an error. */
static struct proc *
-cur_thread ()
+cur_thread (void)
{
struct inf *inf = cur_inf ();
struct proc *thread = inf_tid_to_thread (inf, inferior_pid);
/* Returns the current inferior, but signals an error if it has no task. */
static struct inf *
-active_inf ()
+active_inf (void)
{
struct inf *inf = cur_inf ();
if (!inf->task)
end up looping in mysterious Bpt traps */
void
-flush_inferior_icache (pc, amount)
- CORE_ADDR pc;
+flush_inferior_icache (CORE_ADDR pc, int amount)
{
vm_machine_attribute_val_t flush = MATTR_VAL_ICACHE_FLUSH;
error_t ret;