* monitor.c (monitor_insert_breakpoint): Handle bi-endian machines.

This commit is contained in:
David Edelsohn 1996-12-10 01:32:17 +00:00
parent 509ffa78cf
commit 15f13cd0ec
2 changed files with 36 additions and 25 deletions

View File

@ -1,3 +1,7 @@
Mon Dec 9 17:12:19 1996 Doug Evans <dje@canuck.cygnus.com>
* monitor.c (monitor_insert_breakpoint): Handle bi-endian machines.
Mon Dec 9 15:58:51 1996 Mark Alexander <marka@cygnus.com> Mon Dec 9 15:58:51 1996 Mark Alexander <marka@cygnus.com>
* config/mips/tm-mips.h: Get rid of call-dummy code. * config/mips/tm-mips.h: Get rid of call-dummy code.

View File

@ -459,14 +459,13 @@ monitor_expect_regexp (pat, buf, buflen)
o give your command o give your command
o *then* wait for the prompt. o *then* wait for the prompt.
Thus the last thing that a procedure does with the serial line Thus the last thing that a procedure does with the serial line will
will be an monitor_expect_prompt(). Exception: monitor_resume does not be an monitor_expect_prompt(). Exception: monitor_resume does not
wait for the prompt, because the terminal is being handed over wait for the prompt, because the terminal is being handed over to
to the inferior. However, the next thing which happens after that the inferior. However, the next thing which happens after that is
is a monitor_wait which does wait for the prompt. a monitor_wait which does wait for the prompt. Note that this
Note that this includes abnormal exit, e.g. error(). This is includes abnormal exit, e.g. error(). This is necessary to prevent
necessary to prevent getting into states from which we can't getting into states from which we can't recover. */
recover. */
int int
monitor_expect_prompt (buf, buflen) monitor_expect_prompt (buf, buflen)
@ -1168,32 +1167,33 @@ monitor_read_memory_single (memaddr, myaddr, len)
cmd = current_monitor->getmem.cmdb; cmd = current_monitor->getmem.cmdb;
} }
/* Send the examine command. */ /* Send the examine command. */
monitor_printf (cmd, memaddr); monitor_printf (cmd, memaddr);
/* If RESP_DELIM is specified, we search for that as a leading delimiter for /* If RESP_DELIM is specified, we search for that as a leading
the register value. Otherwise, we just start searching from the start of delimiter for the memory value. Otherwise, we just start
the buf. */ searching from the start of the buf. */
if (current_monitor->getmem.resp_delim) if (current_monitor->getmem.resp_delim)
monitor_expect_regexp (&getmem_resp_delim_pattern, NULL, 0); monitor_expect_regexp (&getmem_resp_delim_pattern, NULL, 0);
/* Now, read the appropriate number of hex digits for this loc, skipping /* Now, read the appropriate number of hex digits for this loc,
spaces. */ skipping spaces. */
/* Skip leading spaces and "0x" if MO_HEX_PREFIX flag is set */ /* Skip leading spaces and "0x" if MO_HEX_PREFIX flag is set. */
if (current_monitor->flags & MO_HEX_PREFIX) if (current_monitor->flags & MO_HEX_PREFIX)
{ {
int c; int c;
c = readchar (timeout); c = readchar (timeout);
while (c == ' ') while (c == ' ')
c = readchar (timeout); c = readchar (timeout);
if ((c == '0') && ((c = readchar (timeout)) == 'x')) if ((c == '0') && ((c = readchar (timeout)) == 'x'))
; ;
else else
error ("monitor_read_memory_single (0x%x): bad response from monitor: %.*s%c.", error ("monitor_read_memory_single (0x%x): bad response from monitor: %.*s%c.",
memaddr, i, membuf, c); memaddr, i, membuf, c);
} }
for (i = 0; i < len * 2; i++) for (i = 0; i < len * 2; i++)
{ {
@ -1270,20 +1270,21 @@ monitor_read_memory (memaddr, myaddr, len)
len = min (len, 16); len = min (len, 16);
/* See if xfer would cross a 16 byte boundary. If so, clip it. */ /* See if xfer would cross a 16 byte boundary. If so, clip it. */
if (((memaddr ^ (memaddr + len - 1)) & ~0xf) != 0) if (((memaddr ^ (memaddr + len - 1)) & ~0xf) != 0)
len = ((memaddr + len) & ~0xf) - memaddr; len = ((memaddr + len) & ~0xf) - memaddr;
/* send the memory examine command */ /* send the memory examine command */
if (current_monitor->flags & MO_GETMEM_NEEDS_RANGE) if (current_monitor->flags & MO_GETMEM_NEEDS_RANGE)
monitor_printf (current_monitor->getmem.cmdb, memaddr, memaddr + len - 1); monitor_printf (current_monitor->getmem.cmdb, memaddr, memaddr + len - 1);
else else
monitor_printf (current_monitor->getmem.cmdb, memaddr, len); monitor_printf (current_monitor->getmem.cmdb, memaddr, len);
/* If TERM is present, we wait for that to show up. Also, (if TERM is /* If TERM is present, we wait for that to show up. Also, (if TERM
present), we will send TERM_CMD if that is present. In any case, we collect is present), we will send TERM_CMD if that is present. In any
all of the output into buf, and then wait for the normal prompt. */ case, we collect all of the output into buf, and then wait for
the normal prompt. */
if (current_monitor->getmem.term) if (current_monitor->getmem.term)
{ {
@ -1305,9 +1306,9 @@ monitor_read_memory (memaddr, myaddr, len)
p = buf; p = buf;
/* If RESP_DELIM is specified, we search for that as a leading delimiter for /* If RESP_DELIM is specified, we search for that as a leading
the values. Otherwise, we just start searching from the start of the buf. delimiter for the values. Otherwise, we just start searching
*/ from the start of the buf. */
if (current_monitor->getmem.resp_delim) if (current_monitor->getmem.resp_delim)
{ {
@ -1420,7 +1421,13 @@ monitor_insert_breakpoint (addr, shadow)
char *shadow; char *shadow;
{ {
int i; int i;
/* This is only used to compute the size of a breakpoint. */
#ifdef BREAKPOINT
static unsigned char break_insn[] = BREAKPOINT; static unsigned char break_insn[] = BREAKPOINT;
#else
/* In the bi-endian case we assume breakpoints are the same size. */
static unsigned char break_insn[] = BIG_BREAKPOINT;
#endif
for (i = 0; i < NUM_MONITOR_BREAKPOINTS; i++) for (i = 0; i < NUM_MONITOR_BREAKPOINTS; i++)
{ {