Writing to memory now works for both targets.
This commit is contained in:
parent
b2bcf39ca2
commit
f1ca4cbc21
|
@ -534,6 +534,11 @@ get_reg_name (regno)
|
||||||
if (sr_get_debug() > 5)
|
if (sr_get_debug() > 5)
|
||||||
printf ("Got name \"%s\" from regno #%d.\n", buf, regno);
|
printf ("Got name \"%s\" from regno #%d.\n", buf, regno);
|
||||||
|
|
||||||
|
#ifdef LOG_FILE
|
||||||
|
fprintf (log_file, "Got name \"%s\" from regno #%d.\n", buf, regno);
|
||||||
|
fflush (log_file);
|
||||||
|
#endif
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,8 +557,8 @@ monitor_fetch_registers ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* monitor_fetch_register -- fetch register REGNO, or all registers if REGNO is -1.
|
* monitor_fetch_register -- fetch register REGNO, or all registers if REGNO
|
||||||
* Returns errno value.
|
* is -1. Returns errno value.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
monitor_fetch_register (regno)
|
monitor_fetch_register (regno)
|
||||||
|
@ -582,7 +587,7 @@ monitor_fetch_register (regno)
|
||||||
supply_register (regno, (char *) &val);
|
supply_register (regno, (char *) &val);
|
||||||
|
|
||||||
if (*ROMDELIM(GET_REG) != 0) {
|
if (*ROMDELIM(GET_REG) != 0) {
|
||||||
/*** expect (ROMRES(GET_REG)); ***/
|
/*** expect (ROMRES(GET_REG)); ***/
|
||||||
printf_monitor (CMD_END);
|
printf_monitor (CMD_END);
|
||||||
}
|
}
|
||||||
expect_prompt (1);
|
expect_prompt (1);
|
||||||
|
@ -607,13 +612,18 @@ monitor_store_registers ()
|
||||||
registers_changed ();
|
registers_changed ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store register REGNO, or all if REGNO == 0.
|
/*
|
||||||
return errno value. */
|
* monitor_store_register -- store register REGNO, or all if REGNO == 0.
|
||||||
|
* return errno value.
|
||||||
|
*/
|
||||||
void
|
void
|
||||||
monitor_store_register (regno)
|
monitor_store_register (regno)
|
||||||
int regno;
|
int regno;
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = read_register(regno);
|
||||||
|
|
||||||
#ifdef LOG_FILE
|
#ifdef LOG_FILE
|
||||||
fprintf (log_file, "\nIn Store_register (regno=%d)\n", regno);
|
fprintf (log_file, "\nIn Store_register (regno=%d)\n", regno);
|
||||||
|
@ -628,14 +638,12 @@ monitor_store_register (regno)
|
||||||
name = get_reg_name (regno);
|
name = get_reg_name (regno);
|
||||||
if (STREQ(name, ""))
|
if (STREQ(name, ""))
|
||||||
return;
|
return;
|
||||||
printf_monitor (ROMCMD(SET_REG), name); /* send the command */
|
printf_monitor (ROMCMD(SET_REG), name, read_register(regno));
|
||||||
expect (name, 1); /* then strip the leading garbage */
|
expect (name, 1); /* strip the leading garbage */
|
||||||
if (*ROMDELIM(SET_REG) != 0) { /* if there's a delimiter */
|
if (*ROMDELIM(SET_REG) != 0) { /* if there's a delimiter */
|
||||||
expect (ROMDELIM(SET_REG), 1);
|
expect (ROMDELIM(SET_REG), 1);
|
||||||
}
|
get_hex_word(1);
|
||||||
|
printf_monitor ("%d%s\n", i, CMD_END);
|
||||||
if (*ROMDELIM(SET_REG) != 0) {
|
|
||||||
printf_monitor ("%s%s\n",read_register(regno), CMD_END);
|
|
||||||
}
|
}
|
||||||
expect_prompt (1);
|
expect_prompt (1);
|
||||||
}
|
}
|
||||||
|
@ -668,8 +676,10 @@ monitor_files_info ()
|
||||||
dev_name, baudrate);
|
dev_name, baudrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy LEN bytes of data from debugger memory at MYADDR
|
/*
|
||||||
to inferior's memory at MEMADDR. Returns length moved. */
|
* monitor_write_inferior_memory -- Copy LEN bytes of data from debugger
|
||||||
|
* memory at MYADDR to inferior's memory at MEMADDR. Returns length moved.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
monitor_write_inferior_memory (memaddr, myaddr, len)
|
monitor_write_inferior_memory (memaddr, myaddr, len)
|
||||||
CORE_ADDR memaddr;
|
CORE_ADDR memaddr;
|
||||||
|
@ -683,23 +693,25 @@ monitor_write_inferior_memory (memaddr, myaddr, len)
|
||||||
fprintf (log_file, "\nIn Write_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len);
|
fprintf (log_file, "\nIn Write_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MEM_PROMPT "" /* FIXME, bogus */
|
if (sr_get_debug() > 0)
|
||||||
for (i = 0; i < len; i++)
|
printf ("\nTrying to set 0x%x to 0x%x\n", memaddr, myaddr);
|
||||||
{
|
|
||||||
printf_monitor (SET_MEM, memaddr + i);
|
for (i = 0; i < len; i++) {
|
||||||
expect (sprintf (buf, MEM_PROMPT, memaddr + i), 1);
|
printf_monitor (ROMCMD(SET_MEM), memaddr + i, myaddr[i] );
|
||||||
|
if (*ROMDELIM(SET_MEM) != 0) { /* if there's a delimiter */
|
||||||
|
expect (ROMDELIM(SET_MEM), 1);
|
||||||
expect (CMD_DELIM);
|
expect (CMD_DELIM);
|
||||||
printf_monitor ("%x", myaddr[i]);
|
printf_monitor ("%x", myaddr[i]);
|
||||||
if (sr_get_debug())
|
|
||||||
printf ("\nSet 0x%x to 0x%x\n", memaddr + i, myaddr[i]);
|
|
||||||
if (CMD_END)
|
|
||||||
{
|
|
||||||
/*** expect (sprintf (buf, MEM_PROMPT, memaddr + i +1), 1);
|
|
||||||
expect (CMD_DELIM); ***/
|
|
||||||
printf_monitor (CMD_END);
|
|
||||||
}
|
|
||||||
expect_prompt (1);
|
|
||||||
}
|
}
|
||||||
|
/*** printf_monitor ("%x", myaddr[i]); ***/
|
||||||
|
if (sr_get_debug() > 1)
|
||||||
|
printf ("\nSet 0x%x to 0x%x\n", memaddr + i, myaddr[i]);
|
||||||
|
if (*ROMDELIM(SET_MEM) != 0) {
|
||||||
|
expect (CMD_DELIM);
|
||||||
|
printf_monitor (CMD_END);
|
||||||
|
}
|
||||||
|
expect_prompt (1);
|
||||||
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -835,18 +847,21 @@ monitor_insert_breakpoint (addr, shadow)
|
||||||
fprintf (log_file, "\nIn Insert_breakpoint (addr=%x)\n", addr);
|
fprintf (log_file, "\nIn Insert_breakpoint (addr=%x)\n", addr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i <= MAX_MONITOR_BREAKPOINTS; i++)
|
if (sr_get_debug() > 4)
|
||||||
if (breakaddr[i] == 0)
|
printf ("insert_breakpoint() addr = 0x%x\n", addr);
|
||||||
{
|
|
||||||
breakaddr[i] = addr;
|
for (i = 0; i <= MAX_MONITOR_BREAKPOINTS; i++) {
|
||||||
if (sr_get_debug())
|
if (breakaddr[i] == 0) {
|
||||||
printf ("Breakpoint at %x\n", addr);
|
breakaddr[i] = addr;
|
||||||
monitor_read_inferior_memory(addr, shadow, memory_breakpoint_size);
|
if (sr_get_debug() > 4)
|
||||||
printf_monitor(SET_BREAK_CMD, addr);
|
printf ("Breakpoint at %x\n", addr);
|
||||||
expect_prompt(1);
|
monitor_read_inferior_memory(addr, shadow, memory_breakpoint_size);
|
||||||
return 0;
|
printf_monitor(SET_BREAK_CMD, addr);
|
||||||
}
|
expect_prompt(1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Too many breakpoints (> 16) for monitor\n");
|
fprintf(stderr, "Too many breakpoints (> 16) for monitor\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ struct monitor_ops op50n_cmds = {
|
||||||
{
|
{
|
||||||
"x %s\n", /* get a register */
|
"x %s\n", /* get a register */
|
||||||
"=", /* delimiter between registers */
|
"=", /* delimiter between registers */
|
||||||
" ", /* the result */
|
"", /* the result */
|
||||||
},
|
},
|
||||||
"r 0\n", /* download command */
|
"r 0\n", /* download command */
|
||||||
"#", /* monitor command prompt */
|
"#", /* monitor command prompt */
|
||||||
|
|
Loading…
Reference in New Issue