-/* Remote debugging interface for MONITOR boot monitor, for GDB.
+/* Remote debugging interface for boot monitors, for GDB.
Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Rob Savoye for Cygnus.
static void monitor_close();
static void monitor_fetch_register();
static void monitor_store_register();
-static int kiodebug; /* flag set by "set remotedebug" */
+#if 0
+static int sr_get_debug(); /* flag set by "set remotedebug" */
+#endif
static int hashmark; /* flag set by "set hash" */
+/* FIXME: Replace with sr_get_debug (). */
#define LOG_FILE "monitor.log"
#if defined (LOG_FILE)
FILE *log_file;
c = SERIAL_READCHAR(monitor_desc, timeout);
- if (kiodebug)
+ if (sr_get_debug())
putchar(c & 0x7f);
#ifdef LOG_FILE
char *p = string;
int c;
- if (kiodebug)
+ if (sr_get_debug())
printf ("Expecting \"%s\"\n", string);
immediate_quit = 1;
if (*p == '\0')
{
immediate_quit = 0;
- if (kiodebug)
+ if (sr_get_debug())
printf ("\nMatched\n");
return;
}
entry_pt = (int) bfd_get_start_address (exec_bfd);
-#ifdef CREATE_INFERIOR_HOOK
- CREATE_INFERIOR_HOOK (0); /* No process-ID */
-#endif
#ifdef LOG_FILE
fputs ("\nIn Create_inferior()", log_file);
#endif
target_terminal_inferior ();
/* insert_step_breakpoint (); FIXME, do we need this? */
- proceed ((CORE_ADDR)entry_pt, -1, 0); /* Let 'er rip... */
+
+ /* Let 'er rip... */
+ proceed ((CORE_ADDR)entry_pt, TARGET_SIGNAL_DEFAULT, 0);
}
/* Open a connection to a remote debugger.
target_preopen(from_tty);
- monitor_close(0);
+/* if (is_open) */
+ monitor_close(0);
+ strcpy(dev_name, args);
monitor_desc = SERIAL_OPEN(dev_name);
if (monitor_desc == NULL)
*/
static void
monitor_resume (pid, step, sig)
- int pid, step, sig;
+ int pid, step;
+ enum target_signal sig;
{
#ifdef LOG_FILE
fprintf (log_file, "\nIn Resume (step=%d, sig=%d)\n", step, sig);
*/
static int
-monitor_wait (status)
- WAITTYPE *status;
+monitor_wait (pid, status)
+ int pid;
+ struct target_waitstatus *status;
{
int old_timeout = timeout;
#ifdef LOG_FILE
fputs ("\nIn wait ()", log_file);
#endif
- WSETEXIT ((*status), 0);
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = 0;
timeout = 0; /* Don't time out -- user program is running. */
expect_prompt(0); /* Wait for prompt, outputting extraneous text */
- WSETSTOP ((*status), SIGTRAP);
+ status->kind = TARGET_WAITKIND_STOPPED;
+ status->value.sig = TARGET_SIGNAL_TRAP;
timeout = old_timeout;
monitor_store_registers ();
else
{
- if (kiodebug)
+ if (sr_get_debug())
printf ("Setting register %s to 0x%x\n", get_reg_name (regno), read_register (regno));
printf_monitor (SET_REG, get_reg_name (regno),
expect (sprintf (buf, MEM_PROMPT, memaddr + i), 1);
expect (CMD_DELIM);
printf_monitor ("%x", myaddr[i]);
- if (kiodebug)
+ if (sr_get_debug())
printf ("\nSet 0x%x to 0x%x\n", memaddr + i, myaddr[i]);
if (CMD_END)
{
len_this_pass -= startaddr % 16;
if (len_this_pass > (len - count))
len_this_pass = (len - count);
- if (kiodebug)
+ if (sr_get_debug())
printf ("\nDisplay %d bytes at %x\n", len_this_pass, startaddr);
for (i = 0; i < len_this_pass; i++)
printf_monitor (MEM_DIS_CMD, startaddr);
expect (sprintf(buf, MEM_PROMPT, startaddr), 1);
get_hex_byte (&myaddr[count++]);
- if (kiodebug)
+ if (sr_get_debug())
printf ("\nRead a 0x%x from 0x%x\n", myaddr[count-1], startaddr);
if (CMD_END)
{
if (breakaddr[i] == 0)
{
breakaddr[i] = addr;
- if (kiodebug)
+ if (sr_get_debug())
printf ("Breakpoint at %x\n", addr);
monitor_read_inferior_memory(addr, shadow, memory_breakpoint_size);
printf_monitor(SET_BREAK_CMD, addr);
char buf[DOWNLOAD_LINE_SIZE];
int i, bytes_read;
- if (kiodebug)
+ if (sr_get_debug())
printf ("Loading %s to monitor\n", arg);
download = fopen (arg, "r");
void
_initialize_remote_monitors ()
{
- add_show_from_set (
- add_set_cmd ("remotedebug", no_class, var_boolean,
- (char *)&kiodebug,
- "Set debugging of I/O to a serial based Monitor.\n\
-When enabled, debugging info is displayed.",
- &setlist),
- &showlist);
add_show_from_set (
add_set_cmd ("hash", no_class, var_boolean,
(char *)&hashmark,