/* 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;
}
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
{
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;
}
char regbuf[MAX_REGISTER_RAW_SIZE * 2 + 1];
int i;
- name = REGNAMES (regno);
+ name = current_monitor->regnames[regno];
if (!name)
{
char *name;
unsigned int val;
- name = REGNAMES (regno);
+ name = current_monitor->regnames[regno];
if (!name)
return;
{
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;
}
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;
}
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
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);
}
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. */