aboutsummaryrefslogtreecommitdiff
path: root/gdb/monitor.c
diff options
context:
space:
mode:
authorDawn Perchik <dawn@cygnus>1996-06-28 10:53:37 +0000
committerDawn Perchik <dawn@cygnus>1996-06-28 10:53:37 +0000
commitf7ce02f4b37634b5fec1918ecb7c5fb4769bf959 (patch)
tree13d839f09ccc20475b4afd1688d7ee278d52b8d2 /gdb/monitor.c
parent5fc34cfdfb442044106fa95f5f3ffe421a111340 (diff)
downloadgdb-f7ce02f4b37634b5fec1918ecb7c5fb4769bf959.zip
gdb-f7ce02f4b37634b5fec1918ecb7c5fb4769bf959.tar.gz
gdb-f7ce02f4b37634b5fec1918ecb7c5fb4769bf959.tar.bz2
* monitor.c (monitor_debug): Fix remotedebug buffering.
Diffstat (limited to 'gdb/monitor.c')
-rw-r--r--gdb/monitor.c54
1 files changed, 42 insertions, 12 deletions
diff --git a/gdb/monitor.c b/gdb/monitor.c
index a7cece7..69edc9a 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. */