From: Dawn Perchik Date: Fri, 28 Jun 1996 10:53:37 +0000 (+0000) Subject: * monitor.c (monitor_debug): Fix remotedebug buffering. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f7ce02f4b37634b5fec1918ecb7c5fb4769bf959;p=binutils-gdb.git * monitor.c (monitor_debug): Fix remotedebug buffering. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3ddb14e1c2a..2b22ff02b01 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +Fri Jun 28 03:47:17 1996 Dawn Perchik + + * monitor.c (monitor_debug): Fix remotedebug buffering. + Thu Jun 27 18:24:17 1996 Stan Shebs * config/i386/cygwin32.mh, config/powerpc/cygwin32.mh diff --git a/gdb/monitor.c b/gdb/monitor.c index a7cece7c3bf..69edc9a1ad4 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -137,7 +137,23 @@ monitor_debug (prefix, string, suffix) /* print prefix and suffix after each line */ static int new_line=1; - if (new_line==1) { /* print prefix if last char was a newline */ + static char *prev_prefix = ""; + static char *prev_suffix = ""; + + /* if the prefix is changing, print the previous suffix, a new line, + and the new prefix */ + if (strcmp(prev_prefix, prefix) != 0 && !new_line) + { + fputs_unfiltered (prev_suffix, gdb_stderr); + fputs_unfiltered ("\n", gdb_stderr); + fputs_unfiltered (prefix, gdb_stderr); + } + prev_prefix = prefix; + prev_suffix = suffix; + + /* print prefix if last char was a newline*/ + + if (new_line == 1) { fputs_unfiltered (prefix, gdb_stderr); new_line=0; } @@ -446,7 +462,7 @@ monitor_expect_prompt (buf, buflen) char *buf; int buflen; { - return monitor_expect (PROMPT, buf, buflen); + return monitor_expect (current_monitor->prompt, buf, buflen); } /* Get N 32-bit words from remote, each preceded by a space, and put @@ -679,10 +695,10 @@ monitor_resume (pid, step, sig) { dcache_flush (remote_dcache); if (step) - monitor_printf (STEP_CMD); + monitor_printf (current_monitor->step); else { - monitor_printf (CONT_CMD); + monitor_printf (current_monitor->cont); if (current_monitor->flags & MO_NEED_REGDUMP_AFTER_CONT) dump_reg_flag = 1; } @@ -850,7 +866,7 @@ monitor_fetch_register (regno) char regbuf[MAX_REGISTER_RAW_SIZE * 2 + 1]; int i; - name = REGNAMES (regno); + name = current_monitor->regnames[regno]; if (!name) { @@ -955,7 +971,7 @@ monitor_store_register (regno) char *name; unsigned int val; - name = REGNAMES (regno); + name = current_monitor->regnames[regno]; if (!name) return; @@ -1351,7 +1367,7 @@ monitor_insert_breakpoint (addr, shadow) { breakaddr[i] = addr; monitor_read_memory (addr, shadow, sizeof (break_insn)); - monitor_printf (SET_BREAK_CMD, addr); + monitor_printf (current_monitor->set_break, addr); monitor_expect_prompt (NULL, 0); return 0; } @@ -1376,9 +1392,9 @@ monitor_remove_breakpoint (addr, shadow) breakaddr[i] = 0; /* some monitors remove breakpoints based on the address */ if (current_monitor->flags & MO_CLR_BREAK_USES_ADDR) - monitor_printf (CLR_BREAK_CMD, addr); + monitor_printf (current_monitor->clr_break, addr); else - monitor_printf (CLR_BREAK_CMD, i); + monitor_printf (current_monitor->clr_break, i); monitor_expect_prompt (NULL, 0); return 0; } @@ -1387,6 +1403,18 @@ monitor_remove_breakpoint (addr, shadow) return 1; } +/* monitor_wait_srec_ack -- wait for the target to send an acknowledgement for + an S-record. Return non-zero if the ACK is received properly. */ + +static int +monitor_wait_srec_ack () +{ + /* FIXME: eventually we'll want to be able to handle acknowledgements + of something other than a '+' character. Right now this is only + going to work for EST visionICE. */ + return readchar (timeout) == '+'; +} + /* monitor_load -- download a file. */ static void @@ -1400,11 +1428,13 @@ monitor_load (file, from_tty) current_monitor->load_routine (monitor_desc, file, hashmark); else { /* The default is ascii S-records */ - monitor_printf (LOAD_CMD); /* tell the monitor to load */ + monitor_printf (current_monitor->load); if (current_monitor->loadresp) monitor_expect (current_monitor->loadresp, NULL, 0); - load_srec (monitor_desc, file, 32, SREC_ALL, hashmark); + load_srec (monitor_desc, file, 32, SREC_ALL, hashmark, + current_monitor->flags & MO_SREC_ACK ? + monitor_wait_srec_ack : NULL); monitor_expect_prompt (NULL, 0); } @@ -1450,7 +1480,7 @@ monitor_command (args, from_tty) if (monitor_desc == NULL) error ("monitor target not open."); - p = PROMPT; + p = current_monitor->prompt; /* Send the command. Note that if no args were supplied, then we're just sending the monitor a newline, which is sometimes useful. */