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 */
static int
readchar ()
{
- int ok;
int buf;
- buf = serial_timedreadchar(timeout, &ok);
+ buf = serial_readchar(timeout);
- if (!ok)
+ if (buf < 0)
error ("Timeout reading from remote system.");
if (!quiet)
static int
readchar_nofail ()
{
- int ok;
int buf;
- buf = serial_timedreadchar(timeout, &ok);
- if (!ok) buf = 0;
+ buf = serial_readchar(timeout);
+ if (buf < 0) buf = 0;
if (!quiet)
printf("%c",buf);
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()");
}
while (1)
{
- serial_timedreadchar(timeout, &ok);
- if (!ok) break;
+ ok = serial_readchar(timeout);
+ if (ok < 0) break;
}
hms_write("r",1);
static void
get_baudrate_right()
{
+#if 0
while (!is_baudrate_right())
{
baudrate = serial_nextbaudrate(baudrate);
QUIT;
serial_setbaudrate(baudrate);
}
+#endif
}
static void
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, 0, 0, /* conv_to, conv_from */
+ hms_prepare_to_store,
hms_xfer_inferior_memory,
hms_files_info,
hms_insert_breakpoint, hms_remove_breakpoint, /* Breakpoints */
0, /* lookup_symbol */
hms_create_inferior, /* create_inferior */
hms_mourn, /* mourn_inferior FIXME */
+ 0, /* can_run */
+ 0, /* notice_signals */
process_stratum, 0, /* next */
1, 1, 1, 1, 1, /* all mem, mem, stack, regs, exec */
0,0, /* Section pointers */
add_com ("speed", class_obscure, hms_speed,
"Set the terminal line speed for HMS communications");
+#if 0
dev_name = serial_default_name();
+#endif
+ dev_name = NULL;
}
-
-