From: Stu Grossman Date: Wed, 15 Mar 1995 23:31:14 +0000 (+0000) Subject: * findvar.c (read_register_bytes write_register_bytes): Make X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2081365ffad350959629339d1633b41ecc6fc95f;p=binutils-gdb.git * findvar.c (read_register_bytes write_register_bytes): Make these routines much smarter about updating registers from the target, only doing so when absolutely necessary. This really speeds up register modification on some remote targets. * monitor.c: More cleanups. Get rid of monitor_load_ascii_srec. BFD makes this unnecessary. Lots of debugging speedups. * (expect): NULL terminate return string. * (monitor_open monitor_supply_register parse_register_dump monitor_wait monitor_fetch_register): Switch to using GNU regexp library to parse multi-register displays. * (monitor_read_memory): Read multiple bytes (up to 16) at once. * (monitor_create_inferior): Call clear_proceed_status to make run command notice first breakpoint. * (monitor_load): Clean up. Reset inferior_pid, set pc to start address and reset symbol table stuff to make loads put things into a fresh state. * (monitor_load_srec): Lower sleep time to 1 second. * monitor.h (struct monitor_ops): Add register_pattern and supply_register to monitor_ops. * rom68k-rom.c: Add new support for handling register dumps. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a01d0d2da3a..bb490a357e1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,29 @@ +Wed Mar 15 15:09:29 1995 Stu Grossman (grossman@cygnus.com) + + * findvar.c (read_register_bytes write_register_bytes): Make + these routines much smarter about updating registers from the + target, only doing so when absolutely necessary. This really + speeds up register modification on some remote targets. + + * monitor.c: More cleanups. Get rid of monitor_load_ascii_srec. + BFD makes this unnecessary. Lots of debugging speedups. + * (expect): NULL terminate return string. + * (monitor_open monitor_supply_register parse_register_dump + monitor_wait monitor_fetch_register): Switch to using GNU regexp + library to parse multi-register displays. + * (monitor_read_memory): Read multiple bytes (up to 16) at once. + * (monitor_create_inferior): Call clear_proceed_status to make run + command notice first breakpoint. + * (monitor_load): Clean up. Reset inferior_pid, set pc to start + address and reset symbol table stuff to make loads put things into + a fresh state. + * (monitor_load_srec): Lower sleep time to 1 second. + + * monitor.h (struct monitor_ops): Add register_pattern and + supply_register to monitor_ops. + + * rom68k-rom.c: Add new support for handling register dumps. + Wed Mar 15 15:18:27 1995 Jim Kingdon (kingdon@lioth.cygnus.com) * utils.c, defs.h (putchar_unfiltered, fputc_unfiltered): Make diff --git a/gdb/monitor.h b/gdb/monitor.h index ad21b024234..59b66913af8 100644 --- a/gdb/monitor.h +++ b/gdb/monitor.h @@ -76,6 +76,13 @@ struct monitor_ops { struct cmd_resp getmem; /* display memory */ struct cmd_resp setreg; /* set a register */ struct cmd_resp getreg; /* get a register */ + /* Some commands can dump a bunch of registers + at once. This comes as a set of REG=VAL + pairs. This should be called for each pair + of registers that we can parse to supply + GDB with the value of a register. */ + char *register_pattern; /* Pattern that picks out register from reg dump */ + void (*supply_register) PARAMS ((char *name, int namelen, char *val, int vallen)); char *load; /* load command */ char *prompt; /* monitor command prompt */ char *cmd_delim; /* end-of-command delimitor */ @@ -133,3 +140,4 @@ extern struct monitor_ops *current_monitor; #define REG_DELIM (current_monitor->regset.delim) extern void monitor_open PARAMS ((char *args, struct monitor_ops *ops, int from_tty)); +extern char *monitor_supply_register PARAMS ((int regno, char *valstr)); diff --git a/gdb/rom68k-rom.c b/gdb/rom68k-rom.c index 5673d5091aa..ad5dd005c8f 100644 --- a/gdb/rom68k-rom.c +++ b/gdb/rom68k-rom.c @@ -25,7 +25,57 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "monitor.h" #include "serial.h" -void rom68k_open(); +static void rom68k_open PARAMS ((char *args, int from_tty)); + +static void +rom68k_supply_register (regname, regnamelen, val, vallen) + char *regname; + int regnamelen; + char *val; + int vallen; +{ + int numregs; + int regno; + + numregs = 1; + regno = -1; + + if (regnamelen == 2) + switch (regname[0]) + { + case 'S': + if (regname[1] == 'R') + regno = PS_REGNUM; + break; + case 'P': + if (regname[1] == 'C') + regno = PC_REGNUM; + break; + case 'D': + if (regname[1] != 'R') + break; + regno = D0_REGNUM; + numregs = 8; + break; + case 'A': + if (regname[1] != 'R') + break; + regno = A0_REGNUM; + numregs = 7; + break; + } + else if (regnamelen == 3) + switch (regname[0]) + { + case 'I': + if (regname[1] == 'S' && regname[2] == 'P') + regno = SP_REGNUM; + } + + if (regno >= 0) + while (numregs-- > 0) + val = monitor_supply_register (regno++, val); +} /* * this array of registers need to match the indexes used by GDB. The @@ -66,7 +116,7 @@ static struct monitor_ops rom68k_cmds = NULL, /* setreg.term_cmd */ }, { - "dm %x 1\r", /* getmem.cmd (addr) */ + "dm %x %x\r", /* getmem.cmd (addr, len) */ " ", /* getmem.resp_delim */ NULL, /* getmem.term */ NULL, /* getmem.term_cmd */ @@ -83,6 +133,9 @@ static struct monitor_ops rom68k_cmds = "= ", /* getreg.term */ ".\r" /* getreg.term_cmd */ }, + /* register_pattern */ + "\\(\\w+\\)=\\([0-9a-fA-F]+\\( +[0-9a-fA-F]+\\b\\)*\\)", + rom68k_supply_register, /* supply_register */ "dc\r", /* download command */ "ROM68K :->", /* monitor command prompt */ "=", /* end-of-command delimitor */