* target.h: Comments on target_attach args and results.
* infcmd.c (attach_command): Check for existing execution, call
target_attach, set up terminal status and wait_for_inferior, wait
for the attach status, and do normal_stop.
* inftarg.c (child_attach): Remove target independent stuff.
* remote-adapt.c (adapt_attach): Ditto.
* remote-mm.c (mm_attach): Ditto.
* remote-udi.c (udi_attach): Ditto.
* remote-vx.c (vx_attach): Ditto.
Cleanup.
* remote-hms.c (hms_attach): Remove completely, it was useless.
* remote-mm.c, remote-hms.c, remote-udi.c, remote-adapt.c: Remove
commented-out start_remote calls.
* remote-hms.c, remote-adapt.c, remote-mm.c, remote-udi.c: Remove
DENTER and DEXIT macros and their calls. Use a real debugger --
like gdb -- to see what functions are being called when.
+Fri Sep 25 21:59:27 1992 John Gilmore (gnu@cygnus.com)
+
+ Split non-target-dependent code out of target_attach routines.
+
+ * target.h: Comments on target_attach args and results.
+ * infcmd.c (attach_command): Check for existing execution, call
+ target_attach, set up terminal status and wait_for_inferior, wait
+ for the attach status, and do normal_stop.
+ * inftarg.c (child_attach): Remove target independent stuff.
+ * remote-adapt.c (adapt_attach): Ditto.
+ * remote-mm.c (mm_attach): Ditto.
+ * remote-udi.c (udi_attach): Ditto.
+ * remote-vx.c (vx_attach): Ditto.
+
+ Cleanup.
+
+ * remote-hms.c (hms_attach): Remove completely, it was useless.
+ * remote-mm.c, remote-hms.c, remote-udi.c, remote-adapt.c: Remove
+ commented-out start_remote calls.
+ * remote-hms.c, remote-adapt.c, remote-mm.c, remote-udi.c: Remove
+ DENTER and DEXIT macros and their calls. Use a real debugger --
+ like gdb -- to see what functions are being called when.
+
Fri Sep 25 18:48:20 1992 John Gilmore (gnu@cygnus.com)
* infrun.c, inftarg.c, inferior.h: Comment and lint cleanups.
}
-/* Attach to process PID, then initialize for debugging it
- and wait for the trace-trap that results from attaching. */
+/* Attach to process PID, then initialize for debugging it. */
static void
child_attach (args, from_tty)
char *exec_file;
int pid;
- dont_repeat();
-
if (!args)
error_no_arg ("process-id to attach");
if (pid == getpid()) /* Trying to masturbate? */
error ("I refuse to debug myself!");
- if (target_has_execution)
- {
- if (query ("A program is being debugged already. Kill it? "))
- target_kill ();
- else
- error ("Inferior not killed.");
- }
-
if (from_tty)
{
exec_file = (char *) get_exec_file (0);
attach (pid);
inferior_pid = pid;
push_target (&child_ops);
-
- mark_breakpoints_out ();
- target_terminal_init ();
- clear_proceed_status ();
- stop_soon_quietly = 1;
- /*proceed (-1, 0, -2);*/
- target_terminal_inferior ();
- wait_for_inferior ();
-#ifdef SOLIB_ADD
- SOLIB_ADD ((char *)0, from_tty, (struct target_ops *)0);
-#endif
- normal_stop ();
#endif /* ATTACH_DETACH */
}
#define FREEZE_MODE (read_register(CPS_REGNUM) && 0x400)
#define USE_SHADOW_PC ((processor_type == TYPE_A29050) && FREEZE_MODE)
-
-/* #define DEBUG /* */
-#ifdef DEBUG
-# define DENTER(NAME) (printf_filtered("Entering %s\n",NAME), fflush(stdout))
-# define DEXIT(NAME) (printf_filtered("Exiting %s\n",NAME), fflush(stdout))
-#else
-# define DENTER(NAME)
-# define DEXIT(NAME)
-#endif
-
/* Can't seem to get binary coff working */
#define ASCII_COFF /* Adapt will be downloaded with ascii coff */
char *arg;
int from_tty;
{
- DENTER("adapt_kill()");
fprintf (adapt_stream, "K");
fprintf (adapt_stream, "\r");
expect_prompt ();
- DEXIT("adapt_kill()");
}
/*
* Download a file specified in 'args', to the adapt.
int n;
char buffer[1024];
- DENTER("adapt_load()");
if (!adapt_stream) {
printf_filtered("Adapt not open. Use 'target' command to open adapt\n");
return;
expect_prompt (); /* Skip garbage that comes out */
fprintf (adapt_stream, "\r");
expect_prompt ();
- DEXIT("adapt_load()");
}
/* This is called not only when we first attach, but also when the
{
int entry_pt;
- DENTER("adapt_create_inferior()");
-
if (args && *args)
error ("Can't pass arguments to remote adapt process.");
} else {
printf_filtered("Adapt not open yet.\n");
}
- DEXIT("adapt_create_inferior()");
}
/* Translate baud rates from integers to damn B_codes. Unix should
unsigned int prl;
char *p;
- DENTER("adapt_open()");
/* Find the first whitespace character, it separates dev_name from
prog_name. */
if (name == 0)
adapt_stream = fdopen (adapt_desc, "r+");
push_target (&adapt_ops);
- /* start_remote (); /* Initialize gdb process mechanisms */
-
#ifndef HAVE_TERMIO
#ifndef NO_SIGINTERRUPT
fprintf_filtered(stderr,
"Freeze-mode debugging not available, and can only be done on an A29050.\n");
}
- DEXIT("adapt_open()");
}
/* Close out all files and local state before this target loses control. */
int quitting;
{
- DENTER("adapt_close()");
-
/* Clear any break points */
adapt_clear_breakpoints();
log_file = NULL;
}
#endif
- DEXIT("adapt_close()");
}
/* Attach to the target that is already loaded and possibly running */
int from_tty;
{
- DENTER("adapt_attach()");
if (from_tty)
printf_filtered ("Attaching to remote program %s.\n", prog_name);
- /* push_target(&adapt_ops); /* This done in adapt_open() */
-
- mark_breakpoints_out ();
-
/* Send the adapt a kill. It is ok if it is not already running */
fprintf(adapt_stream, "K\r"); fflush(adapt_stream);
expect_prompt(); /* Slurp the echo */
-
- /* We will get a task spawn event immediately. */
- init_wait_for_inferior ();
- clear_proceed_status ();
- stop_soon_quietly = 1;
- wait_for_inferior ();
- stop_soon_quietly = 0;
- normal_stop ();
- DEXIT("adapt_attach()");
}
char *args;
int from_tty;
{
- DENTER("adapt_detach()");
+
if (adapt_stream) { /* Send it on its way (tell it to continue) */
adapt_clear_breakpoints();
fprintf(adapt_stream,"G\r");
pop_target(); /* calls adapt_close to do the real work */
if (from_tty)
printf_filtered ("Ending remote %s debugging\n", target_shortname);
- DEXIT("adapt_detach()");
}
/* Tell the remote machine to resume. */
adapt_resume (step, sig)
int step, sig;
{
- DENTER("adapt_resume()");
if (step)
{
write (adapt_desc, "t 1,s\r", 6);
/* Swallow the echo. */
expect_prompt();
}
- DEXIT("adapt_resume()");
}
/* Wait until the remote machine stops, then return,
int old_timeout = timeout;
int old_immediate_quit = immediate_quit;
- DENTER("adapt_wait()");
-
WSETEXIT ((*status), 0);
if (need_artificial_trap != 0)
WSETEXIT ((*status), 0);
timeout = old_timeout;
immediate_quit = old_immediate_quit;
- DEXIT("adapt_wait()");
return 0;
}
int sreg_buf[16];
int i,j;
- DENTER("adapt_fetch_registers()");
-
/*
* Global registers
*/
expect ("GR001 ");
get_hex_regs (1, GR1_REGNUM);
expect_prompt ();
-
- DEXIT("adapt_fetch_registers()");
}
/* Fetch register REGNO, or all registers if REGNO is -1.
adapt_fetch_register (regno)
int regno;
{
- DENTER("adapt_fetch_register()");
if (regno == -1)
adapt_fetch_registers ();
else
get_hex_regs (1, regno);
expect_prompt ();
}
- DEXIT("adapt_fetch_register()");
}
/* Store the remote registers from the contents of the block REGS. */
{
int i, j;
- DENTER("adapt_store_registers()");
fprintf (adapt_stream, "s gr1,%x\r", read_register (GR1_REGNUM));
expect_prompt ();
registers_changed ();
expect_prompt ();
}
- DEXIT("adapt_store_registers()");
}
/* Get ready to modify the registers array. On machines which store
int i;
unsigned int cps;
- /* DENTER("adapt_write_inferior_memory()"); */
-
-/* Turn TU bit off so we can do 'sb' commands */
+ /* Turn TU bit off so we can do 'sb' commands */
cps = read_register(CPS_REGNUM);
if (cps & 0x00000800)
write_register(CPS_REGNUM,cps&~(0x00000800));
/* Restore the old value of cps if the TU bit was on */
if (cps & 0x00000800)
write_register(CPS_REGNUM,cps);
- /* DEXIT("adapt_write_inferior_memory()"); */
return len;
}
adapt_read_bytes (CORE_ADDR_MAX - 3, foo, 4)
doesn't need to work. Detect it and give up if there's an attempt
to do that. */
- /* DENTER("adapt_read_inferior_memory()"); */
if (((memaddr - 1) + len) < memaddr)
return EIO;
startaddr += len_this_pass;
}
-
- /* DEXIT("adapt_read_inferior_memory()"); */
return count;
}
CORE_ADDR addr;
char *save; /* Throw away, let adapt save instructions */
{
- DENTER("adapt_insert_breakpoint()");
if (num_brkpts < MAX_BREAKS) {
num_brkpts++;
fprintf (adapt_stream, "B %x", addr);
fprintf (adapt_stream, "\r");
expect_prompt ();
- DEXIT("adapt_insert_breakpoint() success");
return(0); /* Success */
} else {
fprintf_filtered(stderr,
"Too many break points, break point not installed\n");
- DEXIT("adapt_insert_breakpoint() failure");
return(1); /* Failure */
}
CORE_ADDR addr;
char *save; /* Throw away, let adapt save instructions */
{
- DENTER("adapt_remove_breakpoint()");
if (num_brkpts > 0) {
num_brkpts--;
fprintf (adapt_stream, "BR %x", addr);
fflush (adapt_stream);
expect_prompt ();
}
- DEXIT("adapt_remove_breakpoint()");
return(0);
}
static int
adapt_clear_breakpoints()
{
- DENTER("adapt_clear_breakpoint()");
if (adapt_stream) {
fprintf (adapt_stream, "BR"); /* Clear all break points */
fprintf (adapt_stream, "\r");
expect_prompt ();
}
num_brkpts = 0;
- DEXIT("adapt_clear_breakpoint()");
}
static void
adapt_mourn()
{
- DENTER("adapt_mourn()");
adapt_clear_breakpoints();
pop_target (); /* Pop back to no-child state */
generic_mourn_inferior ();
- DEXIT("adapt_mourn()");
}
/* Display everthing we read in from the adapt until we match/see the
static int quiet = 1;
-#ifdef DEBUG
-# define DENTER(NAME) if (!quiet) (printf_filtered("Entering %s\n",NAME), fflush(stdout))
-# define DEXIT(NAME) if (!quiet) (printf_filtered("Exiting %s\n",NAME), fflush(stdout))
-#else
-# define DENTER(NAME)
-# define DEXIT(NAME)
-#endif
-
-
/***********************************************************************/
/* Caching stuff stolen from remote-nindy.c */
int n;
char buffer[1024];
-
- DENTER("hms_load()");
check_open();
dcache_flush();
sprintf(buffer, "r PC=%x", abfd->start_address);
hms_write_cr(buffer);
expect_prompt();
-
- DEXIT("hms_load()");
}
/* This is called not only when we first attach, but also when the
{
int entry_pt;
char buffer[100];
- DENTER("hms_create_inferior()");
if (args && *args)
error ("Can't pass arguments to remote hms process.");
insert_breakpoints (); /* Needed to get correct instruction in cache */
proceed(entry_pt, -1, 0);
-
-
- DEXIT("hms_create_inferior()");
}
unsigned int prl;
char *p;
- DENTER("hms_open()");
if(name == 0)
{
name = "";
-
}
if (is_open)
- hms_close (0);
+ hms_close (0);
if (name && strlen(name))
- dev_name = strdup(name);
+ dev_name = strdup(name);
if (!serial_open(dev_name))
- perror_with_name ((char *)dev_name);
+ perror_with_name ((char *)dev_name);
serial_raw();
is_open = 1;
-
dcache_init();
-
- /* start_remote (); /* Initialize gdb process mechanisms */
-
get_baudrate_right();
/* Hello? Are you there? */
/* Clear any break points */
hms_clear_breakpoints();
-
printf_filtered("Connected to remote H8/300 HMS system.\n");
-
- DEXIT("hms_open()");
}
/* Close out all files and local state before this target loses control. */
int quitting;
{
- DENTER("hms_close()");
/* Clear any break points */
hms_clear_breakpoints();
serial_write("R\r", 2);
serial_close();
is_open = 0;
-
- DEXIT("hms_close()");
}
-/* Attach to the target that is already loaded and possibly running */
-static void
-hms_attach (args, from_tty)
- char *args;
- int from_tty;
-{
-
- DENTER("hms_attach()");
-
- /* push_target(&hms_ops); /* This done in hms_open() */
-
- mark_breakpoints_out ();
-
- /* Send the hms a kill. It is ok if it is not already running */
-#if 0
- fprintf(hms_stream, "K\r");
- expect_prompt(); /* Slurp the echo */
-#endif
- /* We will get a task spawn event immediately. */
- init_wait_for_inferior ();
- clear_proceed_status ();
- stop_soon_quietly = 1;
- wait_for_inferior ();
- stop_soon_quietly = 0;
- normal_stop ();
- DEXIT("hms_attach()");
-}
-
-
/* Terminate the open connection to the remote debugger.
Use this when you want to detach and do something else
with your gdb. */
char *args;
int from_tty;
{
- DENTER("hms_detach()");
if (is_open)
{
hms_clear_breakpoints();
pop_target(); /* calls hms_close to do the real work */
if (from_tty)
printf_filtered ("Ending remote %s debugging\n", target_shortname);
- DEXIT("hms_detach()");
}
/* Tell the remote machine to resume. */
hms_resume (step, sig)
int step, sig;
{
- DENTER("hms_resume()");
dcache_flush();
if (step)
hms_write_cr("g");
expect("g");
}
- DEXIT("hms_resume()");
}
/* Wait until the remote machine stops, then return,
int old_immediate_quit = immediate_quit;
int swallowed_cr = 0;
- DENTER("hms_wait()");
-
WSETEXIT ((*status), 0);
if (need_artificial_trap != 0)
timeout = old_timeout;
immediate_quit = old_immediate_quit;
- DEXIT("hms_wait()");
return 0;
}
hms_write_cr(buffer);
expect_prompt();
}
-
- DEXIT("hms_store_registers()");
-
}
CORE_ADDR addr;
char *save; /* Throw away, let hms save instructions */
{
- DENTER("hms_insert_breakpoint()");
check_open();
if (num_brkpts < MAX_BREAKS)
sprintf(buffer,"b %x", addr & 0xffff);
hms_write_cr(buffer);
expect_prompt ();
- DEXIT("hms_insert_breakpoint() success");
return(0);
}
else
{
fprintf_filtered(stderr,
"Too many break points, break point not installed\n");
- DEXIT("hms_insert_breakpoint() failure");
return(1);
}
CORE_ADDR addr;
char *save; /* Throw away, let hms save instructions */
{
- DENTER("hms_remove_breakpoint()");
if (num_brkpts > 0)
{
char buffer[100];
expect_prompt();
}
- DEXIT("hms_remove_breakpoint()");
return(0);
}
hms_clear_breakpoints()
{
- DENTER("hms_clear_breakpoint()");
if (is_open) {
hms_write_cr("b -");
expect_prompt ();
}
num_brkpts = 0;
- DEXIT("hms_clear_breakpoint()");
}
static void
hms_mourn()
{
- DENTER("hms_mourn()");
hms_clear_breakpoints();
generic_mourn_inferior ();
- DEXIT("hms_mourn()");
}
by a serial line.",
hms_open, hms_close,
- hms_attach, hms_detach, hms_resume, hms_wait,
+ 0, hms_detach, hms_resume, hms_wait, /* attach */
hms_fetch_register, hms_store_register,
hms_prepare_to_store,
hms_xfer_inferior_memory,
/* Offset of member MEMBER in a struct of type TYPE. */
#define offsetof(TYPE, MEMBER) ((int) &((TYPE *)0)->MEMBER)
-/* #define DEBUG 1 /* */
-#ifdef DEBUG
-# define DENTER(NAME) (printf("Entering %s\n",NAME), fflush(stdout))
-# define DEXIT(NAME) (printf("Exiting %s\n",NAME), fflush(stdout))
-#else
-# define DENTER(NAME)
-# define DEXIT(NAME)
-#endif
-
#define DRAIN_INPUT() (msg_recv_serial((union msg_t*)0))
extern int stop_soon_quietly; /* for wait_for_inferior */
char *token[MAX_TOKENS];
char cmd_line[BUFFER_SIZE];
- DENTER("mm_create_inferior()");
-
if (args && *args)
error ("Can't pass arguments to remote mm process (yet).");
Assuming you are at NYU debuging a kernel, i.e., no need to download.\n\n");
/* We will get a task spawn event immediately. */
-#ifdef NOTDEF /* start_remote() now does a wait without a resume
- so don't use it*/
- start_remote ();
-#else
init_wait_for_inferior ();
clear_proceed_status ();
stop_soon_quietly = 1;
proceed(-1,-1,0);
normal_stop ();
-#endif
- DEXIT("mm_create_inferior()");
}
/**************************************************** REMOTE_MOURN_INFERIOR */
static void
mm_mourn()
{
- DENTER("mm_mourn()");
pop_target (); /* Pop back to no-child state */
generic_mourn_inferior ();
- DEXIT("mm_mourn()");
}
/********************************************************************** damn_b
unsigned int prl;
char *p;
- DENTER("mm_open()");
-
/* Find the first whitespace character, it separates dev_name from
prog_name. */
for (p = name;
out_msg_buf->go_msg.length = 0;
msg_send_serial(out_msg_buf);
/* No message to expect after a GO */
-
- DEXIT("mm_open()");
}
/**************************************************************** REMOTE_CLOSE
mm_close (quitting) /*FIXME: how is quitting used */
int quitting;
{
- DENTER("mm_close()");
-
if (mm_desc < 0)
error ("Can't close remote connection: not debugging remotely.");
#endif
printf ("Ending remote debugging\n");
-
- DEXIT("mm_close()");
-
}
/************************************************************* REMOTE_ATACH */
int from_tty;
{
- DENTER("mm_attach()");
-
if (!mm_stream)
error ("MiniMon not opened yet, use the 'target minimon' command.\n");
- dont_repeat();
-
if (from_tty)
printf ("Attaching to remote program %s...\n", prog_name);
-
/* Make sure the target is currently running, it is supposed to be. */
/* FIXME: is it ok to send MiniMon a BREAK if it is already stopped in
* the dbg core. If so, we don't need to send this GO.
out_msg_buf->break_msg.code = BREAK;
out_msg_buf->break_msg.length = 0;
msg_send_serial(out_msg_buf);
-
- mark_breakpoints_out ();
- init_wait_for_inferior ();
- clear_proceed_status ();
- stop_soon_quietly = 1;
- wait_for_inferior ();
- stop_soon_quietly = 0;
- normal_stop ();
-
- DEXIT("mm_attach()");
}
/********************************************************** REMOTE_DETACH */
/* Terminate the open connection to the remote debugger.
char *args;
int from_tty;
{
- DENTER("mm_dettach()");
remove_breakpoints(); /* Just in case there were any left in */
out_msg_buf->go_msg.code = GO;
out_msg_buf->go_msg.length = 0;
msg_send_serial(out_msg_buf);
pop_target(); /* calls mm_close to do the real work */
- DEXIT("mm_dettach()");
}
mm_resume (step, sig)
int step, sig;
{
- DENTER("mm_resume()");
-
if (sig)
error ("Can't send signals to a remote MiniMon system.");
out_msg_buf->go_msg.length = 0;
msg_send_serial(out_msg_buf);
}
-
- DEXIT("mm_resume()");
}
/***************************************************************** REMOTE_WAIT
int old_timeout = timeout;
int old_immediate_quit = immediate_quit;
- DENTER("mm_wait()");
WSETEXIT ((*status), 0);
timeout = old_timeout; /* Restore original timeout value */
immediate_quit = old_immediate_quit;
- DEXIT("mm_wait()");
return 0;
}
return;
}
- DENTER("mm_fetch_registers()");
-
/* Gr1/rsp */
out_msg_buf->read_req_msg.byte_count = 4*1;
out_msg_buf->read_req_msg.memory_space = GLOBAL_REG;
supply_register (FPS_REGNUM, &val);
supply_register (EXO_REGNUM, &val);
}
-
- DEXIT("mm_fetch_registerS()");
}
return;
}
- DENTER("mm_store_registers()");
result = 0;
out_msg_buf->write_r_msg.code= WRITE_REQ;
}
registers_changed ();
- DEXIT("mm_store_registers()");
- /* FIXME return result; it is ignored by caller. */
}
/*************************************************** REMOTE_PREPARE_TO_STORE */
CORE_ADDR addr;
char *contents_cache;
{
- DENTER("mm_insert_breakpoint()");
out_msg_buf->bkpt_set_msg.code = BKPT_SET;
out_msg_buf->bkpt_set_msg.length = 4*4;
out_msg_buf->bkpt_set_msg.memory_space = I_MEM;
out_msg_buf->bkpt_set_msg.bkpt_type = -1; /* use illop for 29000 */
msg_send_serial( out_msg_buf);
if (expect_msg(BKPT_SET_ACK,in_msg_buf,1)) {
- DEXIT("mm_insert_breakpoint() success");
return 0; /* Success */
} else {
- DEXIT("mm_insert_breakpoint() failure");
return 1; /* Failure */
}
}
CORE_ADDR addr;
char *contents_cache;
{
- DENTER("mm_remove_breakpoint()");
out_msg_buf->bkpt_rm_msg.code = BKPT_RM;
out_msg_buf->bkpt_rm_msg.length = 4*3;
out_msg_buf->bkpt_rm_msg.memory_space = I_MEM;
out_msg_buf->bkpt_rm_msg.bkpt_addr = (ADDR32) addr;
msg_send_serial( out_msg_buf);
if (expect_msg(BKPT_RM_ACK,in_msg_buf,1)) {
- DEXIT("mm_remove_breakpoint()");
return 0; /* Success */
} else {
- DEXIT("mm_remove_breakpoint()");
return 1; /* Failure */
}
}
{
char buf[4];
- DENTER("mm_kill()");
#if defined(KERNEL_DEBUGGING)
/* We don't ever kill the kernel */
if (from_tty) {
}
pop_target();
#endif
- DEXIT("mm_kill()");
}
{
int i,nwritten;
- /* DENTER("mm_write_inferior_memory()"); */
out_msg_buf->write_req_msg.code= WRITE_REQ;
out_msg_buf->write_req_msg.memory_space = mm_memory_space(memaddr);
break;
}
}
- /* DEXIT("mm_write_inferior_memory()"); */
return(nwritten);
}
{
int i,nread;
- /* DENTER("mm_read_inferior_memory()"); */
out_msg_buf->read_req_msg.code= READ_REQ;
out_msg_buf->read_req_msg.memory_space = mm_memory_space(memaddr);
int regno;
{
int result;
- DENTER("mm_fetch_register()");
out_msg_buf->read_req_msg.code= READ_REQ;
out_msg_buf->read_req_msg.length = 4*3;
out_msg_buf->read_req_msg.byte_count = 4;
} else {
result = -1;
}
- DEXIT("mm_fetch_register()");
return result;
}
/*****************************************************************************/
{
int result;
- DENTER("store_register()");
out_msg_buf->write_req_msg.code= WRITE_REQ;
out_msg_buf->write_req_msg.length = 4*4;
out_msg_buf->write_req_msg.byte_count = 4;
} else {
result = -1;
}
- DEXIT("store_register()");
return result;
}
/****************************************************************************/
union msg_t *msg_buf; /* Where to put the message received */
int from_tty; /* Print message on error if non-zero */
{
- /* DENTER("expect_msg()"); */
int retries=0;
while(msg_recv_serial(msg_buf) && (retries++<MAX_RETRIES));
if (retries >= MAX_RETRIES) {
printf("Expected msg %s, ",msg_str(msgcode));
printf("no message received!\n");
- /* DEXIT("expect_msg() failure"); */
return(0); /* Failure */
}
if (msg_buf->generic_msg.code == ERROR)
printf("%s\n",error_msg_str(msg_buf->error_msg.error_code));
}
- /* DEXIT("expect_msg() failure"); */
return(0); /* Failure */
}
- /* DEXIT("expect_msg() success"); */
return(1); /* Success */
}
/****************************************************************************/
#include "29k-share/udi/udiproc.h"
/* access the register store directly, without going through
- the normal handler functions. This avoids an extra data copy
-*/
-
-/* #define DEBUG 1 /* */
-#ifdef DEBUG
-# define DENTER(NAME) (printf("Entering %s\n",NAME), fflush(stdout))
-# define DEXIT(NAME) (printf("Exiting %s\n",NAME), fflush(stdout))
-#else
-# define DENTER(NAME)
-# define DEXIT(NAME)
-#endif
-
+ the normal handler functions. This avoids an extra data copy. */
extern int stop_soon_quietly; /* for wait_for_inferior */
extern struct value *call_function_by_hand();
char *args;
char **env;
{
- DENTER("udi_create_inferior()");
if (execfile)
{ if (prog_name != NULL)
udi_load(args, 0);
#endif /* !ULTRA3 */
- /* We will get a task spawn event immediately. */
-#ifdef NOTDEF /* start_remote() now does a wait without a resume
- so don't use it*/
- start_remote ();
-#else
init_wait_for_inferior ();
clear_proceed_status ();
proceed(-1,-1,0);
-#endif
- DEXIT("udi_create_inferior()");
}
/******************************************************* UDI_MOURN_INFERIOR */
static void
udi_mourn()
{
- DENTER("udi_mourn()");
pop_target (); /* Pop back to no-child state */
generic_mourn_inferior ();
- DEXIT("udi_mourn()");
}
/******************************************************************** UDI_OPEN
UDIPId PId;
UDIUInt32 TIPId, TargetId, DFEId, DFE, TIP, DFEIPCId, TIPIPCId;
- DENTER("udi_open()");
-
target_preopen(from_tty);
/* Find the first whitespace character, it separates udi_config_id
int quitting;
{
int Terminate = -1;
- DENTER("udi_close()");
if (udi_session_id < 0)
error ("Can't close udi connection: not debugging remotely.");
#endif
printf_filtered (" Ending remote debugging\n");
-
- DEXIT("udi_close()");
}
/**************************************************************** UDI_ATACH */
UDISizeT Size = 4;
UDICount CountDone;
UDIBool HostEndian = 0;
- DENTER("udi_attach()");
if (udi_session_id < 0)
error ("UDI connection not opened yet, use the 'target udi' command.\n");
if (from_tty)
printf ("Attaching to remote program %s...\n", prog_name);
- mark_breakpoints_out ();
UDIStop();
From.Space = 11;
From.Offset = UDI29KSpecialRegs;
if(UDIRead(From, &PC_adds, Count, Size, &CountDone, HostEndian))
error ("UDIRead failed in udi_attach");
printf ("Remote process is now halted, pc1 = 0x%x.\n", PC_adds);
-
- DEXIT("udi_attach()");
}
/************************************************************* UDI_DETACH */
/* Terminate the open connection to the TIP process.
char *args;
int from_tty;
{
- DENTER("udi_dettach()");
remove_breakpoints(); /* Just in case there were any left in */
if(UDIDisconnect(udi_session_id))
error ("UDIDisconnect() failed in udi_detach");
pop_target(); /* calls udi_close to do the real work */
if (from_tty)
printf ("Ending remote debugging\n");
- DEXIT("udi_dettach()");
}
UDIUInt32 Steps = 1;
UDIStepType StepType = UDIStepNatural;
UDIRange Range;
- DENTER("udi_resume()");
+
if (step) /* step 1 instruction */
{ tip_error = tip_error = UDIStep(Steps, StepType, Range);
if(tip_error)fprintf(stderr, "UDIStep() error = %d\n", tip_error);
{ if(UDIExecute())
error ("UDIExecute() failed in udi_resume");
}
-
- DEXIT("udi_resume()");
}
/******************************************************************** UDI_WAIT
int old_immediate_quit = immediate_quit;
int i;
- DENTER("udi_wait()");
WSETEXIT ((*status), 0);
/* wait for message to arrive. It should be:
timeout = old_timeout; /* Restore original timeout value */
immediate_quit = old_immediate_quit;
- DEXIT("udi_wait()");
return 0;
}
{
char buf[4];
- DENTER("udi_kill()");
#if defined(ULTRA3) && defined(KERNEL_DEBUGGING)
/* We don't ever kill the kernel */
if (from_tty) {
}
pop_target();
#endif
- DEXIT("udi_kill()");
}
UDICount CountDone = 0;
UDIBool HostEndian = 0;
-
- /* DENTER("udi_write_inferior_memory()"); */
To.Space = udi_memory_space(memaddr);
From = (UDIUInt32*)myaddr;
From += CountDone;
}
}
- /* DEXIT("udi_write_inferior_memory()"); */
return(nwritten);
}
UDICount CountDone = 0;
UDIBool HostEndian = 0;
-
- /* DENTER("udi_read_inferior_memory()"); */
From.Space = udi_memory_space(memaddr);
To = (UDIUInt32*)myaddr;
UDICount CountDone;
UDIBool HostEndian = 0;
- DENTER("store_register()");
From = read_register (regno); /* get data value */
if (regno == GR1_REGNUM)
result = UDIWrite(&From, To, Count, Size, &CountDone, HostEndian);
}
- DEXIT("store_register()");
if(result)
{ result = -1;
error("UDIWrite() failed in store_registers");
clnt_freeres (pClient, xdr_ldtabl, &loadTable);
}
\f
-/* attach_command --
- takes a task started up outside of gdb and ``attaches'' to it.
+/* Takes a task started up outside of gdb and ``attaches'' to it.
This stops it cold in its tracks and allows us to start tracing it. */
static void
Ptrace_return ptrace_out;
int status;
- dont_repeat();
-
if (!args)
error_no_arg ("process-id to attach");
push_target (&vx_run_ops);
inferior_pid = pid;
vx_running = 0;
-
- mark_breakpoints_out ();
-
- /* Set up the "saved terminal modes" of the inferior
- based on what modes we are starting it with. */
- target_terminal_init ();
-
- /* Install inferior's terminal modes. */
- target_terminal_inferior ();
-
- /* We will get a task spawn event immediately. */
- init_wait_for_inferior ();
- clear_proceed_status ();
- stop_soon_quietly = 1;
- wait_for_inferior ();
- stop_soon_quietly = 0;
- normal_stop ();
}
int (*to_lookup_symbol) PARAMS ((char *, CORE_ADDR *));
void (*to_create_inferior) PARAMS ((char *, char *, char **));
void (*to_mourn_inferior) PARAMS ((void));
+ int (*to_can_run) PARAMS ((void));
enum strata to_stratum;
struct target_ops
*to_next;
#define target_close(quitting) \
(*current_target->to_close) (quitting)
-/* Attaches to a process on the target side. */
+/* Attaches to a process on the target side. Arguments are as passed
+ to the `attach' command by the user. This routine can be called
+ when the target is not on the target-stack, if the target_can_run
+ routine returns 1; in that case, it must push itself onto the stack.
+ Upon exit, the target should be ready for normal operations, and
+ should be ready to deliver the status of the process immediately
+ (without waiting) to an upcoming target_wait call. */
#define target_attach(args, from_tty) \
(*current_target->to_attach) (args, from_tty)
#define target_mourn_inferior() \
(*current_target->to_mourn_inferior) ()
+/* Does target have enough data to do a run or attach command? */
+
+#define target_can_run(t) \
+ ((t)->to_can_run) ()
+
/* Pointer to next target in the chain, e.g. a core file and an exec file. */
#define target_next \
void
noprocess PARAMS ((void));
+void
+find_default_attach PARAMS ((char *, int));
+
+void
+find_default_create_inferior PARAMS ((char *, char *, char **));
+
#endif /* !defined (TARGET_H) */