* monitor.c (monitor_printf): Changed format specification in
error message to work with pre-ansi compilers. (monitor_load_srec): reduced length of s-records from 128 to 32 bytes so download is more reliable with the rom68k monitor. * rom68k-rom.c: Added trailing space to prompt string. * config/i386/xm-i386sco.h (HAVE_STRSTR): Removed. * config/i386/xm-go32.h, mswin/xm.h (SYS_SIGLIST_MISSING): Removed. * defs.h, config/{xm-lynx.h, xm-nbsd.h}, config/i386/{xm-i386bsd.h, xm-linux.h}, config/m68k/xm-hp300bsd.h, config/mips/xm-irix4.h, config/ns32k/xm-ns32km3.h, doc/gdbint.texinfo (PSIGNAL_IN_SIGNAL_H): Removed.
This commit is contained in:
parent
f57b30fc38
commit
eba0864375
13 changed files with 312 additions and 87 deletions
|
@ -1,5 +1,25 @@
|
||||||
|
Wed May 17 15:55:53 1995 J.T. Conklin <jtc@rtl.cygnus.com>
|
||||||
|
|
||||||
|
* monitor.c (monitor_printf): Changed format specification in
|
||||||
|
error message to work with pre-ansi compilers.
|
||||||
|
(monitor_load_srec): reduced length of s-records from 128 to 32
|
||||||
|
bytes so download is more reliable with the rom68k monitor.
|
||||||
|
|
||||||
|
* rom68k-rom.c: Added trailing space to prompt string.
|
||||||
|
|
||||||
|
* config/i386/xm-i386sco.h (HAVE_STRSTR): Removed.
|
||||||
|
* config/i386/xm-go32.h, mswin/xm.h (SYS_SIGLIST_MISSING):
|
||||||
|
Removed.
|
||||||
|
* defs.h, config/{xm-lynx.h, xm-nbsd.h},
|
||||||
|
config/i386/{xm-i386bsd.h, xm-linux.h},
|
||||||
|
config/m68k/xm-hp300bsd.h, config/mips/xm-irix4.h,
|
||||||
|
config/ns32k/xm-ns32km3.h, doc/gdbint.texinfo
|
||||||
|
(PSIGNAL_IN_SIGNAL_H): Removed.
|
||||||
|
|
||||||
Tue May 16 13:16:06 1995 J.T. Conklin <jtc@rtl.cygnus.com>
|
Tue May 16 13:16:06 1995 J.T. Conklin <jtc@rtl.cygnus.com>
|
||||||
|
|
||||||
|
* Makefile.in (Makefile): Added config.status to dependency list.
|
||||||
|
|
||||||
* configure.in: Added INIT-CMDS argument to AC_OUTPUT which sets
|
* configure.in: Added INIT-CMDS argument to AC_OUTPUT which sets
|
||||||
gdb_host_cpu, gdb_target_cpu and nativefile.
|
gdb_host_cpu, gdb_target_cpu and nativefile.
|
||||||
* configure: regenerated.
|
* configure: regenerated.
|
||||||
|
|
|
@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#define SYS_SIGLIST_MISSING 1
|
|
||||||
#define HOST_BYTE_ORDER LITTLE_ENDIAN
|
#define HOST_BYTE_ORDER LITTLE_ENDIAN
|
||||||
#include "fopen-bin.h"
|
#include "fopen-bin.h"
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#include <machine/limits.h> /* for INT_MIN, to avoid "INT_MIN
|
#include <machine/limits.h> /* for INT_MIN, to avoid "INT_MIN
|
||||||
redefined" warnings from defs.h */
|
redefined" warnings from defs.h */
|
||||||
|
|
||||||
/* psignal() is in <signal.h>. */
|
|
||||||
|
|
||||||
#define PSIGNAL_IN_SIGNAL_H
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
So we use dots instead. This item must be coordinated with G++. */
|
So we use dots instead. This item must be coordinated with G++. */
|
||||||
#undef CPLUS_MARKER
|
#undef CPLUS_MARKER
|
||||||
#define CPLUS_MARKER '.'
|
#define CPLUS_MARKER '.'
|
||||||
#define HAVE_STRSTR
|
|
||||||
|
|
||||||
/* Use setpgid instead of setpgrp on SCO */
|
/* Use setpgid instead of setpgrp on SCO */
|
||||||
#define NEED_POSIX_SETPGID
|
#define NEED_POSIX_SETPGID
|
||||||
|
|
|
@ -24,7 +24,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
/* This is the amount to subtract from u.u_ar0
|
/* This is the amount to subtract from u.u_ar0
|
||||||
to get the offset in the core file of the register values. */
|
to get the offset in the core file of the register values. */
|
||||||
#define KERNEL_U_ADDR 0x0
|
#define KERNEL_U_ADDR 0x0
|
||||||
#define PSIGNAL_IN_SIGNAL_H
|
|
||||||
|
|
||||||
#define NEED_POSIX_SETPGID
|
#define NEED_POSIX_SETPGID
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
/* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */
|
/* Kernel is a bit tenacious about sharing text segments, disallowing bpts. */
|
||||||
#define ONE_PROCESS_WRITETEXT
|
#define ONE_PROCESS_WRITETEXT
|
||||||
|
|
||||||
/* psignal's definition in 4.4BSD conflicts with the one in defs.h.
|
|
||||||
But there *is* no psignal definition in 4.3BSD. So we avoid the defs.h
|
|
||||||
version here, and supply our own (matching) one. */
|
|
||||||
#define PSIGNAL_IN_SIGNAL_H
|
|
||||||
void psignal PARAMS ((unsigned int, const char *));
|
|
||||||
|
|
||||||
extern char *strdup PARAMS ((const char *));
|
extern char *strdup PARAMS ((const char *));
|
||||||
|
|
||||||
/* Interface definitions for kernel debugger KDB. */
|
/* Interface definitions for kernel debugger KDB. */
|
||||||
|
|
|
@ -22,11 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#include "mips/xm-irix3.h"
|
#include "mips/xm-irix3.h"
|
||||||
|
|
||||||
/* Irix defines psignal() in signal.h, in a way which conflicts with the
|
|
||||||
definition in defs.h. */
|
|
||||||
|
|
||||||
#define PSIGNAL_IN_SIGNAL_H
|
|
||||||
|
|
||||||
#define BROKEN_SIGINFO_H /* <sys/siginfo.h> si_pid & si_uid are bogus */
|
#define BROKEN_SIGINFO_H /* <sys/siginfo.h> si_pid & si_uid are bogus */
|
||||||
|
|
||||||
/* Irix 4.0.1 and later have termios. Not sure about earlier versions. */
|
/* Irix 4.0.1 and later have termios. Not sure about earlier versions. */
|
||||||
|
|
|
@ -26,6 +26,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/* Do implement the attach and detach commands. */
|
/* Do implement the attach and detach commands. */
|
||||||
#define ATTACH_DETACH 1
|
#define ATTACH_DETACH 1
|
||||||
|
|
||||||
/* signal.h has declaration for psignal() */
|
|
||||||
#define PSIGNAL_IN_SIGNAL_H
|
|
||||||
|
|
|
@ -21,8 +21,4 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
/* psignal() is in <signal.h>. */
|
|
||||||
|
|
||||||
#define PSIGNAL_IN_SIGNAL_H
|
|
||||||
|
|
||||||
#define MEM_FNS_DECLARED
|
#define MEM_FNS_DECLARED
|
||||||
|
|
|
@ -30,6 +30,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/* NetBSD has termios facilities. */
|
/* NetBSD has termios facilities. */
|
||||||
#define HAVE_TERMIOS
|
#define HAVE_TERMIOS
|
||||||
|
|
||||||
/* psignal() is in <signal.h>. */
|
|
||||||
#define PSIGNAL_IN_SIGNAL_H
|
|
||||||
|
|
10
gdb/defs.h
10
gdb/defs.h
|
@ -266,7 +266,7 @@ extern char *re_comp PARAMS ((const char *));
|
||||||
|
|
||||||
extern void symbol_file_command PARAMS ((char *, int));
|
extern void symbol_file_command PARAMS ((char *, int));
|
||||||
|
|
||||||
/* From main.c */
|
/* From top.c */
|
||||||
|
|
||||||
extern char *skip_quoted PARAMS ((char *));
|
extern char *skip_quoted PARAMS ((char *));
|
||||||
|
|
||||||
|
@ -278,6 +278,8 @@ extern void print_prompt PARAMS ((void));
|
||||||
|
|
||||||
extern int input_from_terminal_p PARAMS ((void));
|
extern int input_from_terminal_p PARAMS ((void));
|
||||||
|
|
||||||
|
extern int info_verbose;
|
||||||
|
|
||||||
/* From printcmd.c */
|
/* From printcmd.c */
|
||||||
|
|
||||||
extern void set_next_address PARAMS ((CORE_ADDR));
|
extern void set_next_address PARAMS ((CORE_ADDR));
|
||||||
|
@ -587,10 +589,6 @@ extern char *getenv PARAMS ((const char *));
|
||||||
|
|
||||||
/* From other system libraries */
|
/* From other system libraries */
|
||||||
|
|
||||||
#ifndef PSIGNAL_IN_SIGNAL_H
|
|
||||||
extern void psignal PARAMS ((unsigned, const char *));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -837,8 +835,6 @@ extern int (*target_wait_hook) PARAMS ((int pid,
|
||||||
extern void (*call_command_hook) PARAMS ((struct cmd_list_element *c,
|
extern void (*call_command_hook) PARAMS ((struct cmd_list_element *c,
|
||||||
char *cmd, int from_tty));
|
char *cmd, int from_tty));
|
||||||
|
|
||||||
extern NORETURN void (*error_hook) PARAMS (());
|
|
||||||
|
|
||||||
/* Inhibit window interface if non-zero. */
|
/* Inhibit window interface if non-zero. */
|
||||||
|
|
||||||
extern int use_windows;
|
extern int use_windows;
|
||||||
|
|
339
gdb/monitor.c
339
gdb/monitor.c
|
@ -43,6 +43,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
#include "regex.h"
|
#include "regex.h"
|
||||||
|
|
||||||
|
static int readchar PARAMS ((int timeout));
|
||||||
|
|
||||||
static void monitor_command PARAMS ((char *args, int fromtty));
|
static void monitor_command PARAMS ((char *args, int fromtty));
|
||||||
static void monitor_load_srec PARAMS ((char *args));
|
static void monitor_load_srec PARAMS ((char *args));
|
||||||
|
|
||||||
|
@ -56,6 +58,11 @@ static void monitor_store_register PARAMS ((int regno));
|
||||||
static void monitor_close PARAMS ((int quitting));
|
static void monitor_close PARAMS ((int quitting));
|
||||||
static void monitor_detach PARAMS ((char *args, int from_tty));
|
static void monitor_detach PARAMS ((char *args, int from_tty));
|
||||||
static void monitor_resume PARAMS ((int pid, int step, enum target_signal sig));
|
static void monitor_resume PARAMS ((int pid, int step, enum target_signal sig));
|
||||||
|
static void monitor_interrupt PARAMS ((int signo));
|
||||||
|
static void monitor_interrupt_twice PARAMS ((int signo));
|
||||||
|
static void monitor_interrupt_query PARAMS ((void));
|
||||||
|
static void monitor_wait_cleanup PARAMS ((int old_timeout));
|
||||||
|
|
||||||
static int monitor_wait PARAMS ((int pid, struct target_waitstatus *status));
|
static int monitor_wait PARAMS ((int pid, struct target_waitstatus *status));
|
||||||
static void monitor_fetch_registers PARAMS ((int regno));
|
static void monitor_fetch_registers PARAMS ((int regno));
|
||||||
static void monitor_store_registers PARAMS ((int regno));
|
static void monitor_store_registers PARAMS ((int regno));
|
||||||
|
@ -78,6 +85,8 @@ static int hashmark; /* flag set by "set hash" */
|
||||||
|
|
||||||
static int timeout = 30;
|
static int timeout = 30;
|
||||||
|
|
||||||
|
static void (*ofunc)(); /* Old SIGINT signal handler */
|
||||||
|
|
||||||
/* Descriptor for I/O to remote machine. Initialize it to NULL so
|
/* Descriptor for I/O to remote machine. Initialize it to NULL so
|
||||||
that monitor_open knows that we don't have a file open when the
|
that monitor_open knows that we don't have a file open when the
|
||||||
program starts. */
|
program starts. */
|
||||||
|
@ -98,7 +107,38 @@ static char fastmap[256];
|
||||||
static int dump_reg_flag; /* Non-zero means do a dump_registers cmd when
|
static int dump_reg_flag; /* Non-zero means do a dump_registers cmd when
|
||||||
monitor_wait wakes up. */
|
monitor_wait wakes up. */
|
||||||
|
|
||||||
/* monitor_printf -- send data to monitor. Works just like printf. */
|
/* monitor_printf_noecho -- Send data to monitor, but don't expect an echo.
|
||||||
|
Works just like printf. */
|
||||||
|
|
||||||
|
void
|
||||||
|
monitor_printf_noecho (va_alist)
|
||||||
|
va_dcl
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
char *pattern;
|
||||||
|
char sndbuf[2000];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
va_start (args);
|
||||||
|
|
||||||
|
pattern = va_arg (args, char *);
|
||||||
|
|
||||||
|
vsprintf (sndbuf, pattern, args);
|
||||||
|
|
||||||
|
if (remote_debug > 0)
|
||||||
|
fputs_unfiltered (sndbuf, gdb_stderr);
|
||||||
|
|
||||||
|
len = strlen (sndbuf);
|
||||||
|
|
||||||
|
if (len + 1 > sizeof sndbuf)
|
||||||
|
abort ();
|
||||||
|
|
||||||
|
if (SERIAL_WRITE(monitor_desc, sndbuf, len))
|
||||||
|
fprintf_unfiltered (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* monitor_printf -- Send data to monitor and check the echo. Works just like
|
||||||
|
printf. */
|
||||||
|
|
||||||
void
|
void
|
||||||
monitor_printf (va_alist)
|
monitor_printf (va_alist)
|
||||||
|
@ -106,25 +146,43 @@ monitor_printf (va_alist)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *pattern;
|
char *pattern;
|
||||||
char buf[2000];
|
char sndbuf[2000];
|
||||||
int len;
|
int len;
|
||||||
|
int i, c;
|
||||||
|
|
||||||
va_start (args);
|
va_start (args);
|
||||||
|
|
||||||
pattern = va_arg (args, char *);
|
pattern = va_arg (args, char *);
|
||||||
|
|
||||||
vsprintf (buf, pattern, args);
|
vsprintf (sndbuf, pattern, args);
|
||||||
|
|
||||||
if (remote_debug > 0)
|
if (remote_debug > 0)
|
||||||
fputs_unfiltered (buf, gdb_stderr);
|
fputs_unfiltered (sndbuf, gdb_stderr);
|
||||||
|
|
||||||
len = strlen (buf);
|
len = strlen (sndbuf);
|
||||||
|
|
||||||
if (len + 1 > sizeof buf)
|
if (len + 1 > sizeof sndbuf)
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
if (SERIAL_WRITE(monitor_desc, buf, len))
|
if (SERIAL_WRITE(monitor_desc, sndbuf, len))
|
||||||
fprintf_unfiltered (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
|
fprintf_unfiltered (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno));
|
||||||
|
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
trycr:
|
||||||
|
c = readchar (timeout);
|
||||||
|
|
||||||
|
if (c != sndbuf[i])
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
if (sndbuf[i] == '\r'
|
||||||
|
&& c == '\n')
|
||||||
|
goto trycr;
|
||||||
|
#endif
|
||||||
|
error ("monitor_printf: Bad echo. Sent: \"%s\", Got: \"%.*s%c\".",
|
||||||
|
sndbuf, i, sndbuf, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a character from the remote system, doing all the fancy
|
/* Read a character from the remote system, doing all the fancy
|
||||||
|
@ -339,7 +397,11 @@ monitor_open (args, mon_ops, from_tty)
|
||||||
/* See if we can wake up the monitor. First, try sending a stop sequence,
|
/* See if we can wake up the monitor. First, try sending a stop sequence,
|
||||||
then send the init strings. Last, remove all breakpoints. */
|
then send the init strings. Last, remove all breakpoints. */
|
||||||
|
|
||||||
monitor_stop ();
|
if (current_monitor->stop)
|
||||||
|
{
|
||||||
|
monitor_stop ();
|
||||||
|
monitor_expect_prompt (NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* wake up the monitor and see if it's alive */
|
/* wake up the monitor and see if it's alive */
|
||||||
for (p = mon_ops->init; *p != NULL; p++)
|
for (p = mon_ops->init; *p != NULL; p++)
|
||||||
|
@ -348,6 +410,8 @@ monitor_open (args, mon_ops, from_tty)
|
||||||
monitor_expect_prompt (NULL, 0);
|
monitor_expect_prompt (NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SERIAL_FLUSH_INPUT (monitor_desc);
|
||||||
|
|
||||||
/* Remove all breakpoints */
|
/* Remove all breakpoints */
|
||||||
|
|
||||||
if (mon_ops->clr_all_break)
|
if (mon_ops->clr_all_break)
|
||||||
|
@ -363,7 +427,9 @@ monitor_open (args, mon_ops, from_tty)
|
||||||
|
|
||||||
inferior_pid = 42000; /* Make run command think we are busy... */
|
inferior_pid = 42000; /* Make run command think we are busy... */
|
||||||
|
|
||||||
monitor_printf ("\r"); /* Give monitor_wait something to read */
|
/* Give monitor_wait something to read */
|
||||||
|
|
||||||
|
monitor_printf (current_monitor->line_term);
|
||||||
|
|
||||||
start_remote ();
|
start_remote ();
|
||||||
}
|
}
|
||||||
|
@ -467,6 +533,60 @@ parse_register_dump (buf, len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Send ^C to target to halt it. Target will respond, and send us a
|
||||||
|
packet. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
monitor_interrupt (signo)
|
||||||
|
int signo;
|
||||||
|
{
|
||||||
|
/* If this doesn't work, try more severe steps. */
|
||||||
|
signal (signo, monitor_interrupt_twice);
|
||||||
|
|
||||||
|
if (remote_debug)
|
||||||
|
printf_unfiltered ("monitor_interrupt called\n");
|
||||||
|
|
||||||
|
target_stop ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The user typed ^C twice. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
monitor_interrupt_twice (signo)
|
||||||
|
int signo;
|
||||||
|
{
|
||||||
|
signal (signo, ofunc);
|
||||||
|
|
||||||
|
monitor_interrupt_query ();
|
||||||
|
|
||||||
|
signal (signo, monitor_interrupt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ask the user what to do when an interrupt is received. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
monitor_interrupt_query ()
|
||||||
|
{
|
||||||
|
target_terminal_ours ();
|
||||||
|
|
||||||
|
if (query ("Interrupted while waiting for the program.\n\
|
||||||
|
Give up (and stop debugging it)? "))
|
||||||
|
{
|
||||||
|
target_mourn_inferior ();
|
||||||
|
return_to_top_level (RETURN_QUIT);
|
||||||
|
}
|
||||||
|
|
||||||
|
target_terminal_inferior ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
monitor_wait_cleanup (old_timeout)
|
||||||
|
int old_timeout;
|
||||||
|
{
|
||||||
|
timeout = old_timeout;
|
||||||
|
signal (SIGINT, ofunc);
|
||||||
|
}
|
||||||
|
|
||||||
/* Wait until the remote machine stops, then return, storing status in
|
/* Wait until the remote machine stops, then return, storing status in
|
||||||
status just as `wait' would. */
|
status just as `wait' would. */
|
||||||
|
|
||||||
|
@ -478,12 +598,17 @@ monitor_wait (pid, status)
|
||||||
int old_timeout = timeout;
|
int old_timeout = timeout;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int resp_len;
|
int resp_len;
|
||||||
|
struct cleanup *old_chain;
|
||||||
|
|
||||||
status->kind = TARGET_WAITKIND_EXITED;
|
status->kind = TARGET_WAITKIND_EXITED;
|
||||||
status->value.integer = 0;
|
status->value.integer = 0;
|
||||||
|
|
||||||
|
old_chain = make_cleanup (monitor_wait_cleanup, old_timeout);
|
||||||
|
|
||||||
timeout = -1; /* Don't time out -- user program is running. */
|
timeout = -1; /* Don't time out -- user program is running. */
|
||||||
|
|
||||||
|
ofunc = (void (*)()) signal (SIGINT, monitor_interrupt);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
resp_len = monitor_expect_prompt (buf, sizeof (buf));
|
resp_len = monitor_expect_prompt (buf, sizeof (buf));
|
||||||
|
@ -493,6 +618,8 @@ monitor_wait (pid, status)
|
||||||
}
|
}
|
||||||
while (resp_len < 0);
|
while (resp_len < 0);
|
||||||
|
|
||||||
|
signal (SIGINT, ofunc);
|
||||||
|
|
||||||
timeout = old_timeout;
|
timeout = old_timeout;
|
||||||
|
|
||||||
if (dump_reg_flag && current_monitor->dump_registers)
|
if (dump_reg_flag && current_monitor->dump_registers)
|
||||||
|
@ -509,6 +636,8 @@ monitor_wait (pid, status)
|
||||||
status->kind = TARGET_WAITKIND_STOPPED;
|
status->kind = TARGET_WAITKIND_STOPPED;
|
||||||
status->value.sig = TARGET_SIGNAL_TRAP;
|
status->value.sig = TARGET_SIGNAL_TRAP;
|
||||||
|
|
||||||
|
discard_cleanups (old_chain);
|
||||||
|
|
||||||
return inferior_pid;
|
return inferior_pid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,11 +648,10 @@ static void
|
||||||
monitor_fetch_register (regno)
|
monitor_fetch_register (regno)
|
||||||
int regno;
|
int regno;
|
||||||
{
|
{
|
||||||
char buf[200];
|
|
||||||
char *p;
|
|
||||||
char *name;
|
char *name;
|
||||||
int resp_len;
|
|
||||||
static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0};
|
static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0};
|
||||||
|
char regbuf[MAX_REGISTER_RAW_SIZE * 2 + 1];
|
||||||
|
int i;
|
||||||
|
|
||||||
name = REGNAMES (regno);
|
name = REGNAMES (regno);
|
||||||
|
|
||||||
|
@ -537,45 +665,55 @@ monitor_fetch_register (regno)
|
||||||
|
|
||||||
monitor_printf (current_monitor->getreg.cmd, name);
|
monitor_printf (current_monitor->getreg.cmd, name);
|
||||||
|
|
||||||
|
/* If RESP_DELIM is specified, we search for that as a leading delimiter for
|
||||||
|
the register value. Otherwise, we just start searching from the start of
|
||||||
|
the buf. */
|
||||||
|
|
||||||
|
if (current_monitor->getreg.resp_delim)
|
||||||
|
monitor_expect (current_monitor->getreg.resp_delim, NULL, 0);
|
||||||
|
|
||||||
|
/* Now, read the appropriate number of hex digits for this register, skipping
|
||||||
|
spaces. */
|
||||||
|
|
||||||
|
for (i = 0; i < REGISTER_RAW_SIZE (regno) * 2; i++)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
c = readchar (timeout);
|
||||||
|
if (isxdigit (c))
|
||||||
|
break;
|
||||||
|
if (c == ' ')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
error ("monitor_fetch_register (%d): bad response from monitor: %.*s%c.",
|
||||||
|
regno, i, regbuf, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
regbuf[i] = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
regbuf[i] = '\000'; /* terminate the number */
|
||||||
|
|
||||||
/* 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 is
|
||||||
present), we will send TERM_CMD if that is present. In any case, we collect
|
present), we will send TERM_CMD if that is present. In any case, we collect
|
||||||
all of the output into buf, and then wait for the normal prompt. */
|
all of the output into buf, and then wait for the normal prompt. */
|
||||||
|
|
||||||
if (current_monitor->getreg.term)
|
if (current_monitor->getreg.term)
|
||||||
{
|
{
|
||||||
resp_len = monitor_expect (current_monitor->getreg.term, buf, sizeof buf); /* get response */
|
monitor_expect (current_monitor->getreg.term, NULL, 0); /* get response */
|
||||||
|
|
||||||
if (resp_len <= 0)
|
|
||||||
error ("monitor_fetch_register (%d): excessive response from monitor: %.*s.",
|
|
||||||
regno, resp_len, buf);
|
|
||||||
|
|
||||||
if (current_monitor->getreg.term_cmd)
|
if (current_monitor->getreg.term_cmd)
|
||||||
{
|
{
|
||||||
SERIAL_WRITE (monitor_desc, current_monitor->getreg.term_cmd,
|
monitor_printf (current_monitor->getreg.term_cmd);
|
||||||
strlen (current_monitor->getreg.term_cmd));
|
|
||||||
monitor_expect_prompt (NULL, 0);
|
monitor_expect_prompt (NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
resp_len = monitor_expect_prompt (buf, sizeof buf); /* get response */
|
monitor_expect_prompt (NULL, 0); /* get response */
|
||||||
|
|
||||||
|
monitor_supply_register (regno, regbuf);
|
||||||
/* If RESP_DELIM is specified, we search for that as a leading delimiter for
|
|
||||||
the register value. Otherwise, we just start searching from the start of
|
|
||||||
the buf. */
|
|
||||||
|
|
||||||
if (current_monitor->getreg.resp_delim)
|
|
||||||
{
|
|
||||||
p = strstr (buf, current_monitor->getreg.resp_delim);
|
|
||||||
if (!p)
|
|
||||||
error ("monitor_fetch_register (%d): bad response from monitor: %.*s.",
|
|
||||||
regno, resp_len, buf);
|
|
||||||
p += strlen (current_monitor->getreg.resp_delim);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
p = buf;
|
|
||||||
|
|
||||||
monitor_supply_register (regno, p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the remote registers into the block regs. */
|
/* Read the remote registers into the block regs. */
|
||||||
|
@ -717,6 +855,108 @@ monitor_write_memory (memaddr, myaddr, len)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This is an alternate form of monitor_read_memory which is used for monitors
|
||||||
|
which can only read a single byte/word/etc. at a time. */
|
||||||
|
|
||||||
|
static int
|
||||||
|
monitor_read_memory_single (memaddr, myaddr, len)
|
||||||
|
CORE_ADDR memaddr;
|
||||||
|
unsigned char *myaddr;
|
||||||
|
int len;
|
||||||
|
{
|
||||||
|
unsigned LONGEST val;
|
||||||
|
char membuf[sizeof(LONGEST) * 2 + 1];
|
||||||
|
char *p;
|
||||||
|
char *cmd;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((memaddr & 0x7) == 0 && len >= 8 && current_monitor->getmem.cmdll)
|
||||||
|
{
|
||||||
|
len = 8;
|
||||||
|
cmd = current_monitor->getmem.cmdll;
|
||||||
|
}
|
||||||
|
else if ((memaddr & 0x3) == 0 && len >= 4 && current_monitor->getmem.cmdl)
|
||||||
|
{
|
||||||
|
len = 4;
|
||||||
|
cmd = current_monitor->getmem.cmdl;
|
||||||
|
}
|
||||||
|
else if ((memaddr & 0x1) == 0 && len >= 2 && current_monitor->getmem.cmdw)
|
||||||
|
{
|
||||||
|
len = 2;
|
||||||
|
cmd = current_monitor->getmem.cmdw;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len = 1;
|
||||||
|
cmd = current_monitor->getmem.cmdb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Send the examine command. */
|
||||||
|
|
||||||
|
monitor_printf (cmd, memaddr);
|
||||||
|
|
||||||
|
/* If RESP_DELIM is specified, we search for that as a leading delimiter for
|
||||||
|
the register value. Otherwise, we just start searching from the start of
|
||||||
|
the buf. */
|
||||||
|
|
||||||
|
if (current_monitor->getmem.resp_delim)
|
||||||
|
monitor_expect (current_monitor->getmem.resp_delim, NULL, 0);
|
||||||
|
|
||||||
|
/* Now, read the appropriate number of hex digits for this loc, skipping
|
||||||
|
spaces. */
|
||||||
|
|
||||||
|
for (i = 0; i < len * 2; i++)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
c = readchar (timeout);
|
||||||
|
if (isxdigit (c))
|
||||||
|
break;
|
||||||
|
if (c == ' ')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
error ("monitor_read_memory_single (0x%x): bad response from monitor: %.*s%c.",
|
||||||
|
memaddr, i, membuf, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
membuf[i] = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
membuf[i] = '\000'; /* terminate the number */
|
||||||
|
|
||||||
|
/* If TERM is present, we wait for that to show up. Also, (if TERM is
|
||||||
|
present), we will send TERM_CMD if that is present. In any case, we collect
|
||||||
|
all of the output into buf, and then wait for the normal prompt. */
|
||||||
|
|
||||||
|
if (current_monitor->getmem.term)
|
||||||
|
{
|
||||||
|
monitor_expect (current_monitor->getmem.term, NULL, 0); /* get response */
|
||||||
|
|
||||||
|
if (current_monitor->getmem.term_cmd)
|
||||||
|
{
|
||||||
|
monitor_printf (current_monitor->getmem.term_cmd);
|
||||||
|
monitor_expect_prompt (NULL, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
monitor_expect_prompt (NULL, 0); /* get response */
|
||||||
|
|
||||||
|
p = membuf;
|
||||||
|
val = strtoul (membuf, &p, 16);
|
||||||
|
|
||||||
|
if (val == 0 && membuf == p)
|
||||||
|
error ("monitor_read_memory_single (0x%x): bad value from monitor: %s.",
|
||||||
|
memaddr, membuf);
|
||||||
|
|
||||||
|
/* supply register stores in target byte order, so swap here */
|
||||||
|
|
||||||
|
store_unsigned_integer (myaddr, len, val);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
/* Copy LEN bytes of data from debugger memory at MYADDR to inferior's memory
|
/* Copy LEN bytes of data from debugger memory at MYADDR to inferior's memory
|
||||||
at MEMADDR. Returns length moved. Currently, we only do one byte at a
|
at MEMADDR. Returns length moved. Currently, we only do one byte at a
|
||||||
time. */
|
time. */
|
||||||
|
@ -735,6 +975,9 @@ monitor_read_memory (memaddr, myaddr, len)
|
||||||
int resp_len;
|
int resp_len;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (current_monitor->flags & MO_GETMEM_READ_SINGLE)
|
||||||
|
return monitor_read_memory_single (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. */
|
||||||
|
@ -772,9 +1015,6 @@ monitor_read_memory (memaddr, myaddr, len)
|
||||||
|
|
||||||
p = buf;
|
p = buf;
|
||||||
|
|
||||||
while (*p != '\r') /* Skip command echo and line delim */
|
|
||||||
p++;
|
|
||||||
|
|
||||||
/* 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 delimiter for
|
||||||
the values. Otherwise, we just start searching from the start of the buf.
|
the values. Otherwise, we just start searching from the start of the buf.
|
||||||
*/
|
*/
|
||||||
|
@ -818,8 +1058,6 @@ monitor_read_memory (memaddr, myaddr, len)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME-someday! merge these two. */
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
monitor_xfer_memory (memaddr, myaddr, len, write, target)
|
monitor_xfer_memory (memaddr, myaddr, len, write, target)
|
||||||
CORE_ADDR memaddr;
|
CORE_ADDR memaddr;
|
||||||
|
@ -954,11 +1192,8 @@ monitor_load (file, from_tty)
|
||||||
static void
|
static void
|
||||||
monitor_stop ()
|
monitor_stop ()
|
||||||
{
|
{
|
||||||
if (!current_monitor->stop)
|
if (current_monitor->stop)
|
||||||
return;
|
monitor_printf_noecho (current_monitor->stop);
|
||||||
|
|
||||||
monitor_printf(current_monitor->stop);
|
|
||||||
monitor_expect_prompt (NULL, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put a command string, in args, out to MONITOR. Output from MONITOR
|
/* Put a command string, in args, out to MONITOR. Output from MONITOR
|
||||||
|
@ -999,7 +1234,7 @@ monitor_load_srec (args)
|
||||||
asection *s;
|
asection *s;
|
||||||
char *buffer, srec[1024];
|
char *buffer, srec[1024];
|
||||||
int i;
|
int i;
|
||||||
int srec_frame = 128;
|
int srec_frame = 32;
|
||||||
int reclen;
|
int reclen;
|
||||||
|
|
||||||
buffer = alloca (srec_frame * 2 + 256);
|
buffer = alloca (srec_frame * 2 + 256);
|
||||||
|
@ -1038,7 +1273,7 @@ monitor_load_srec (args)
|
||||||
|
|
||||||
reclen = monitor_make_srec (srec, 3, s->vma + i, buffer, numbytes);
|
reclen = monitor_make_srec (srec, 3, s->vma + i, buffer, numbytes);
|
||||||
|
|
||||||
monitor_printf ("%.*s\r", reclen, srec);
|
monitor_printf_noecho ("%.*s\r", reclen, srec);
|
||||||
|
|
||||||
if (hashmark)
|
if (hashmark)
|
||||||
{
|
{
|
||||||
|
@ -1058,11 +1293,13 @@ monitor_load_srec (args)
|
||||||
|
|
||||||
reclen = monitor_make_srec (srec, 7, abfd->start_address, NULL, 0);
|
reclen = monitor_make_srec (srec, 7, abfd->start_address, NULL, 0);
|
||||||
|
|
||||||
monitor_printf ("%.*s\r", reclen, srec);
|
monitor_printf_noecho ("%.*s\r", reclen, srec);
|
||||||
|
|
||||||
monitor_printf ("\r\r"); /* Some monitors need these to wake up */
|
monitor_printf_noecho ("\r\r"); /* Some monitors need these to wake up */
|
||||||
|
|
||||||
monitor_expect_prompt (NULL, 0);
|
monitor_expect_prompt (NULL, 0);
|
||||||
|
|
||||||
|
SERIAL_FLUSH_INPUT (monitor_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -141,7 +141,7 @@ static struct monitor_ops rom68k_cmds =
|
||||||
NULL, /* load_routine (defaults to SRECs) */
|
NULL, /* load_routine (defaults to SRECs) */
|
||||||
"dc\r", /* download command */
|
"dc\r", /* download command */
|
||||||
"Waiting for S-records from host... ", /* Load response */
|
"Waiting for S-records from host... ", /* Load response */
|
||||||
"ROM68K :->", /* monitor command prompt */
|
"ROM68K :-> ", /* monitor command prompt */
|
||||||
"\r", /* end-of-line terminator */
|
"\r", /* end-of-line terminator */
|
||||||
".\r", /* optional command terminator */
|
".\r", /* optional command terminator */
|
||||||
&rom68k_ops, /* target operations */
|
&rom68k_ops, /* target operations */
|
||||||
|
|
Loading…
Reference in a new issue