X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fremote-mon.c;h=115822bfbbd667fef4f2b1acf1b64ee747d16e65;hb=45dc9be38877cbb8218182b5c5ebd6e82e5ccd47;hp=989729ce1eb4548085c1c58122726e61695e0c39;hpb=a94abe5bb7a71b207691f8b50406166eefda8186;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/remote-mon.c b/gdb/remote-mon.c index 989729ce1e..115822bfbb 100644 --- a/gdb/remote-mon.c +++ b/gdb/remote-mon.c @@ -1,4 +1,4 @@ -/* 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. @@ -71,9 +71,12 @@ struct cmd_list_element *showlist; 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; @@ -117,7 +120,7 @@ readchar(timeout) c = SERIAL_READCHAR(monitor_desc, timeout); - if (kiodebug) + if (sr_get_debug()) putchar(c & 0x7f); #ifdef LOG_FILE @@ -150,7 +153,7 @@ expect(string, discard) char *p = string; int c; - if (kiodebug) + if (sr_get_debug()) printf ("Expecting \"%s\"\n", string); immediate_quit = 1; @@ -164,7 +167,7 @@ expect(string, discard) if (*p == '\0') { immediate_quit = 0; - if (kiodebug) + if (sr_get_debug()) printf ("\nMatched\n"); return; } @@ -286,9 +289,6 @@ monitor_create_inferior (execfile, args, env) 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 @@ -309,7 +309,9 @@ monitor_create_inferior (execfile, args, env) 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. @@ -330,8 +332,10 @@ general_open(args, name, from_tty) 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) @@ -433,7 +437,8 @@ monitor_detach (from_tty) */ 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); @@ -459,21 +464,24 @@ monitor_resume (pid, 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; @@ -587,7 +595,7 @@ monitor_store_register (regno) 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), @@ -636,7 +644,7 @@ monitor_write_inferior_memory (memaddr, myaddr, len) 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) { @@ -696,7 +704,7 @@ monitor_read_inferior_memory(memaddr, myaddr, len) 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++) @@ -704,7 +712,7 @@ monitor_read_inferior_memory(memaddr, myaddr, len) 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) { @@ -772,7 +780,7 @@ monitor_insert_breakpoint (addr, shadow) 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); @@ -826,7 +834,7 @@ monitor_load (arg) 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"); @@ -1174,13 +1182,6 @@ Specify the serial device it is connected to (e.g. /dev/ttya).", 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,