1999-04-16 03:35:26 +02:00
|
|
|
/* Generic support for remote debugging interfaces.
|
|
|
|
|
2001-03-06 09:22:02 +01:00
|
|
|
Copyright 1993, 1994, 1995, 1996, 1998, 2000, 2001
|
|
|
|
Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* This file actually contains two distinct logical "packages". They
|
1999-07-07 22:19:36 +02:00
|
|
|
are packaged together in this one file because they are typically
|
|
|
|
used together.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
The first package is an addition to the serial package. The
|
|
|
|
addition provides reading and writing with debugging output and
|
|
|
|
timeouts based on user settable variables. These routines are
|
|
|
|
intended to support serial port based remote backends. These
|
|
|
|
functions are prefixed with sr_.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
The second package is a collection of more or less generic
|
|
|
|
functions for use by remote backends. They support user settable
|
|
|
|
variables for debugging, retries, and the like.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
Todo:
|
|
|
|
|
|
|
|
* a pass through mode a la kermit or telnet.
|
|
|
|
* autobaud.
|
|
|
|
* ask remote to change his baud rate.
|
1999-07-07 22:19:36 +02:00
|
|
|
*/
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "gdb_string.h"
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
#include "target.h"
|
|
|
|
#include "serial.h"
|
1999-07-07 22:19:36 +02:00
|
|
|
#include "gdbcore.h" /* for exec_bfd */
|
|
|
|
#include "inferior.h" /* for generic_mourn_inferior */
|
1999-04-16 03:35:26 +02:00
|
|
|
#include "remote-utils.h"
|
2001-03-01 02:39:22 +01:00
|
|
|
#include "regcache.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
void _initialize_sr_support (void);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
struct _sr_settings sr_settings =
|
|
|
|
{
|
|
|
|
4, /* timeout:
|
|
|
|
remote-hms.c had 2
|
|
|
|
remote-bug.c had "with a timeout of 2, we time out waiting for
|
|
|
|
the prompt after an s-record dump."
|
|
|
|
|
|
|
|
remote.c had (2): This was 5 seconds, which is a long time to
|
|
|
|
sit and wait. Unless this is going though some terminal server
|
|
|
|
or multiplexer or other form of hairy serial connection, I
|
|
|
|
would think 2 seconds would be plenty.
|
|
|
|
*/
|
|
|
|
|
|
|
|
10, /* retries */
|
|
|
|
NULL, /* device */
|
|
|
|
NULL, /* descriptor */
|
1999-04-16 03:35:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct gr_settings *gr_settings = NULL;
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
static void usage (char *, char *);
|
|
|
|
static void sr_com (char *, int);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
static void
|
2000-07-30 03:48:28 +02:00
|
|
|
usage (char *proto, char *junk)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (junk != NULL)
|
1999-07-07 22:19:36 +02:00
|
|
|
fprintf_unfiltered (gdb_stderr, "Unrecognized arguments: `%s'.\n", junk);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("Usage: target %s [DEVICE [SPEED [DEBUG]]]\n\
|
|
|
|
where DEVICE is the name of a device or HOST:PORT"), proto);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define CHECKDONE(p, q) \
|
|
|
|
{ \
|
|
|
|
if (q == p) \
|
|
|
|
{ \
|
|
|
|
if (*p == '\0') \
|
|
|
|
return; \
|
|
|
|
else \
|
|
|
|
usage(proto, p); \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_scan_args (char *proto, char *args)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
char *p, *q;
|
|
|
|
|
|
|
|
/* if no args, then nothing to do. */
|
|
|
|
if (args == NULL || *args == '\0')
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* scan off white space. */
|
1999-07-07 22:19:36 +02:00
|
|
|
for (p = args; isspace (*p); ++p);;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* find end of device name. */
|
1999-07-07 22:19:36 +02:00
|
|
|
for (q = p; *q != '\0' && !isspace (*q); ++q);;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* check for missing or empty device name. */
|
1999-07-07 22:19:36 +02:00
|
|
|
CHECKDONE (p, q);
|
|
|
|
sr_set_device (savestring (p, q - p));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* look for baud rate. */
|
1999-07-07 22:19:36 +02:00
|
|
|
n = strtol (q, &p, 10);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* check for missing or empty baud rate. */
|
1999-07-07 22:19:36 +02:00
|
|
|
CHECKDONE (p, q);
|
1999-04-16 03:35:26 +02:00
|
|
|
baud_rate = n;
|
|
|
|
|
|
|
|
/* look for debug value. */
|
1999-07-07 22:19:36 +02:00
|
|
|
n = strtol (p, &q, 10);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* check for missing or empty debug value. */
|
1999-07-07 22:19:36 +02:00
|
|
|
CHECKDONE (p, q);
|
|
|
|
sr_set_debug (n);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* scan off remaining white space. */
|
1999-07-07 22:19:36 +02:00
|
|
|
for (p = q; isspace (*p); ++p);;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* if not end of string, then there's unrecognized junk. */
|
|
|
|
if (*p != '\0')
|
1999-07-07 22:19:36 +02:00
|
|
|
usage (proto, p);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
gr_generic_checkin (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
sr_write_cr ("");
|
|
|
|
gr_expect_prompt ();
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
gr_open (char *args, int from_tty, struct gr_settings *gr)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
target_preopen (from_tty);
|
|
|
|
sr_scan_args (gr->ops->to_shortname, args);
|
|
|
|
unpush_target (gr->ops);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
gr_settings = gr;
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
if (sr_get_desc () != NULL)
|
1999-04-16 03:35:26 +02:00
|
|
|
gr_close (0);
|
|
|
|
|
|
|
|
/* If no args are specified, then we use the device specified by a
|
|
|
|
previous command or "set remotedevice". But if there is no
|
|
|
|
device, better stop now, not dump core. */
|
|
|
|
|
|
|
|
if (sr_get_device () == NULL)
|
|
|
|
usage (gr->ops->to_shortname, NULL);
|
|
|
|
|
2001-07-15 22:34:14 +02:00
|
|
|
sr_set_desc (serial_open (sr_get_device ()));
|
1999-07-07 22:19:36 +02:00
|
|
|
if (!sr_get_desc ())
|
|
|
|
perror_with_name ((char *) sr_get_device ());
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
if (baud_rate != -1)
|
|
|
|
{
|
2001-07-15 22:34:14 +02:00
|
|
|
if (serial_setbaudrate (sr_get_desc (), baud_rate) != 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2001-07-15 22:34:14 +02:00
|
|
|
serial_close (sr_get_desc ());
|
1999-07-07 22:19:36 +02:00
|
|
|
perror_with_name (sr_get_device ());
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-15 22:34:14 +02:00
|
|
|
serial_raw (sr_get_desc ());
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* If there is something sitting in the buffer we might take it as a
|
|
|
|
response to a command, which would be bad. */
|
2001-07-15 22:34:14 +02:00
|
|
|
serial_flush_input (sr_get_desc ());
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* default retries */
|
1999-07-07 22:19:36 +02:00
|
|
|
if (sr_get_retries () == 0)
|
|
|
|
sr_set_retries (1);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* default clear breakpoint function */
|
|
|
|
if (gr_settings->clear_all_breakpoints == NULL)
|
|
|
|
gr_settings->clear_all_breakpoints = remove_breakpoints;
|
|
|
|
|
|
|
|
if (from_tty)
|
|
|
|
{
|
|
|
|
printf_filtered ("Remote debugging using `%s'", sr_get_device ());
|
|
|
|
if (baud_rate != -1)
|
|
|
|
printf_filtered (" at baud rate of %d",
|
|
|
|
baud_rate);
|
|
|
|
printf_filtered ("\n");
|
|
|
|
}
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
push_target (gr->ops);
|
|
|
|
gr_checkin ();
|
1999-04-16 03:35:26 +02:00
|
|
|
gr_clear_all_breakpoints ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read a character from the remote system masking it down to 7 bits
|
|
|
|
and doing all the fancy timeout stuff. */
|
|
|
|
|
|
|
|
int
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_readchar (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int buf;
|
|
|
|
|
2001-07-15 22:34:14 +02:00
|
|
|
buf = serial_readchar (sr_get_desc (), sr_get_timeout ());
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
if (buf == SERIAL_TIMEOUT)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("Timeout reading from remote system."));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
if (sr_get_debug () > 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
printf_unfiltered ("%c", buf);
|
|
|
|
|
|
|
|
return buf & 0x7f;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_pollchar (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int buf;
|
|
|
|
|
2001-07-15 22:34:14 +02:00
|
|
|
buf = serial_readchar (sr_get_desc (), 0);
|
1999-04-16 03:35:26 +02:00
|
|
|
if (buf == SERIAL_TIMEOUT)
|
|
|
|
buf = 0;
|
1999-07-07 22:19:36 +02:00
|
|
|
if (sr_get_debug () > 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (buf)
|
1999-07-07 22:19:36 +02:00
|
|
|
printf_unfiltered ("%c", buf);
|
1999-04-16 03:35:26 +02:00
|
|
|
else
|
1999-07-07 22:19:36 +02:00
|
|
|
printf_unfiltered ("<empty character poll>");
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return buf & 0x7f;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Keep discarding input from the remote system, until STRING is found.
|
|
|
|
Let the user break out immediately. */
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_expect (char *string)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
char *p = string;
|
|
|
|
|
2000-09-01 02:12:10 +02:00
|
|
|
immediate_quit++;
|
1999-04-16 03:35:26 +02:00
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
if (sr_readchar () == *p)
|
|
|
|
{
|
|
|
|
p++;
|
|
|
|
if (*p == '\0')
|
|
|
|
{
|
2000-09-01 02:12:10 +02:00
|
|
|
immediate_quit--;
|
1999-04-16 03:35:26 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p = string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_write (char *a, int l)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2001-07-15 22:34:14 +02:00
|
|
|
if (serial_write (sr_get_desc (), a, l) != 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
perror_with_name ("sr_write: Error writing to remote");
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
if (sr_get_debug () > 0)
|
1999-04-16 03:35:26 +02:00
|
|
|
for (i = 0; i < l; i++)
|
|
|
|
printf_unfiltered ("%c", a[i]);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_write_cr (char *s)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
sr_write (s, strlen (s));
|
|
|
|
sr_write ("\r", 1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_timed_read (char *buf, int n)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char c;
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < n)
|
|
|
|
{
|
|
|
|
c = sr_readchar ();
|
|
|
|
|
|
|
|
if (c == 0)
|
|
|
|
return i;
|
|
|
|
buf[i] = c;
|
|
|
|
i++;
|
|
|
|
|
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get a hex digit from the remote system & return its value. If
|
|
|
|
ignore_space is nonzero, ignore spaces (not newline, tab, etc). */
|
|
|
|
|
|
|
|
int
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_get_hex_digit (int ignore_space)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int ch;
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
ch = sr_readchar ();
|
|
|
|
if (ch >= '0' && ch <= '9')
|
|
|
|
return ch - '0';
|
|
|
|
else if (ch >= 'A' && ch <= 'F')
|
|
|
|
return ch - 'A' + 10;
|
|
|
|
else if (ch >= 'a' && ch <= 'f')
|
|
|
|
return ch - 'a' + 10;
|
|
|
|
else if (ch != ' ' || !ignore_space)
|
|
|
|
{
|
|
|
|
gr_expect_prompt ();
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("Invalid hex digit from remote system."));
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get a byte from the remote and put it in *BYT. Accept any number
|
|
|
|
leading spaces. */
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_get_hex_byte (char *byt)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int val;
|
|
|
|
|
|
|
|
val = sr_get_hex_digit (1) << 4;
|
|
|
|
val |= sr_get_hex_digit (0);
|
|
|
|
*byt = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read a 32-bit hex word from the remote, preceded by a space */
|
|
|
|
long
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_get_hex_word (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
long val;
|
|
|
|
int j;
|
|
|
|
|
|
|
|
val = 0;
|
|
|
|
for (j = 0; j < 8; j++)
|
|
|
|
val = (val << 4) + sr_get_hex_digit (j == 0);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Put a command string, in args, out to the remote. The remote is assumed to
|
|
|
|
be in raw mode, all writing/reading done through desc.
|
|
|
|
Ouput from the remote is placed on the users terminal until the
|
|
|
|
prompt from the remote is seen.
|
|
|
|
FIXME: Can't handle commands that take input. */
|
|
|
|
|
|
|
|
static void
|
2000-07-30 03:48:28 +02:00
|
|
|
sr_com (char *args, int fromtty)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
sr_check_open ();
|
|
|
|
|
|
|
|
if (!args)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Clear all input so only command relative output is displayed */
|
|
|
|
|
|
|
|
sr_write_cr (args);
|
|
|
|
sr_write ("\030", 1);
|
|
|
|
registers_changed ();
|
|
|
|
gr_expect_prompt ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
gr_close (int quitting)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
gr_clear_all_breakpoints ();
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
if (sr_is_open ())
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2001-07-15 22:34:14 +02:00
|
|
|
serial_close (sr_get_desc ());
|
1999-07-07 22:19:36 +02:00
|
|
|
sr_set_desc (NULL);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* gr_detach()
|
|
|
|
takes a program previously attached to and detaches it.
|
|
|
|
We better not have left any breakpoints
|
|
|
|
in the program or it'll die when it hits one.
|
|
|
|
Close the open connection to the remote debugger.
|
|
|
|
Use this when you want to detach and do something else
|
|
|
|
with your gdb. */
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
gr_detach (char *args, int from_tty)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
if (args)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("Argument given to \"detach\" when remotely debugging."));
|
1999-07-07 22:19:36 +02:00
|
|
|
|
|
|
|
if (sr_is_open ())
|
1999-04-16 03:35:26 +02:00
|
|
|
gr_clear_all_breakpoints ();
|
|
|
|
|
|
|
|
pop_target ();
|
|
|
|
if (from_tty)
|
|
|
|
puts_filtered ("Ending remote debugging.\n");
|
|
|
|
|
|
|
|
return;
|
1999-07-07 22:19:36 +02:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
gr_files_info (struct target_ops *ops)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
#ifdef __GO32__
|
|
|
|
printf_filtered ("\tAttached to DOS asynctsr\n");
|
|
|
|
#else
|
1999-07-07 22:19:36 +02:00
|
|
|
printf_filtered ("\tAttached to %s", sr_get_device ());
|
1999-04-16 03:35:26 +02:00
|
|
|
if (baud_rate != -1)
|
|
|
|
printf_filtered ("at %d baud", baud_rate);
|
|
|
|
printf_filtered ("\n");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (exec_bfd)
|
|
|
|
{
|
|
|
|
printf_filtered ("\tand running program %s\n",
|
|
|
|
bfd_get_filename (exec_bfd));
|
|
|
|
}
|
|
|
|
printf_filtered ("\tusing the %s protocol.\n", ops->to_shortname);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
gr_mourn (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
gr_clear_all_breakpoints ();
|
1999-07-07 22:19:36 +02:00
|
|
|
unpush_target (gr_get_ops ());
|
1999-04-16 03:35:26 +02:00
|
|
|
generic_mourn_inferior ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
gr_kill (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is called not only when we first attach, but also when the
|
|
|
|
user types "run" after having attached. */
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
gr_create_inferior (char *execfile, char *args, char **env)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int entry_pt;
|
|
|
|
|
|
|
|
if (args && *args)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("Can't pass arguments to remote process."));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
if (execfile == 0 || exec_bfd == 0)
|
2005-02-10 Andrew Cagney <cagney@gnu.org>
Mark up all error and warning messages.
* ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update.
* bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update.
* core-aout.c, core-regset.c, corefile.c, corelow.c: Update.
* cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update.
* dbxread.c, demangle.c, doublest.c, dsrec.c: Update.
* dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update.
* event-top.c, exec.c, expprint.c, f-lang.c: Update.
* f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update.
* frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update.
* gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update.
* hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update.
* hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update.
* hpread.c, hpux-thread.c, i386-linux-nat.c: Update.
* i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update.
* ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update.
* infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update.
* kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update.
* linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update.
* m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update.
* m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update.
* maint.c, mdebugread.c, mem-break.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update.
* nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update.
* observer.c, ocd.c, p-lang.c, p-typeprint.c: Update.
* p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update.
* ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update.
* remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update.
* remote-rdp.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote-utils.h, remote.c: Update.
* rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update.
* ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update.
* sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update.
* solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update.
* solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update.
* somread.c, somsolib.c, source.c, stabsread.c: Update.
* stack.c, std-regs.c, symfile-mem.c, symfile.c: Update.
* symmisc.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update.
* uw-thread.c, valarith.c, valops.c, valprint.c: Update.
* value.c, varobj.c, version.in, win32-nat.c, wince.c: Update.
* xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update.
* cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update.
* cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update.
* mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update.
* mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update.
* mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update.
* tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
|
|
|
error (_("No executable file specified"));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
entry_pt = (int) bfd_get_start_address (exec_bfd);
|
|
|
|
sr_check_open ();
|
|
|
|
|
|
|
|
gr_kill ();
|
|
|
|
gr_clear_all_breakpoints ();
|
|
|
|
|
|
|
|
init_wait_for_inferior ();
|
1999-07-07 22:19:36 +02:00
|
|
|
gr_checkin ();
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
insert_breakpoints (); /* Needed to get correct instruction in cache */
|
|
|
|
proceed (entry_pt, -1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given a null terminated list of strings LIST, read the input until we find one of
|
|
|
|
them. Return the index of the string found or -1 on error. '?' means match
|
|
|
|
any single character. Note that with the algorithm we use, the initial
|
|
|
|
character of the string cannot recur in the string, or we will not find some
|
|
|
|
cases of the string in the input. If PASSTHROUGH is non-zero, then
|
|
|
|
pass non-matching data on. */
|
|
|
|
|
|
|
|
int
|
2000-10-16 08:42:28 +02:00
|
|
|
gr_multi_scan (char *list[], int passthrough)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
char *swallowed = NULL; /* holding area */
|
|
|
|
char *swallowed_p = swallowed; /* Current position in swallowed. */
|
1999-04-16 03:35:26 +02:00
|
|
|
int ch;
|
|
|
|
int ch_handled;
|
|
|
|
int i;
|
|
|
|
int string_count;
|
|
|
|
int max_length;
|
|
|
|
char **plist;
|
|
|
|
|
|
|
|
/* Look through the strings. Count them. Find the largest one so we can
|
|
|
|
allocate a holding area. */
|
|
|
|
|
|
|
|
for (max_length = string_count = i = 0;
|
|
|
|
list[i] != NULL;
|
|
|
|
++i, ++string_count)
|
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
int length = strlen (list[i]);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
if (length > max_length)
|
|
|
|
max_length = length;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we have no strings, then something is wrong. */
|
|
|
|
if (string_count == 0)
|
1999-07-07 22:19:36 +02:00
|
|
|
return (-1);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* otherwise, we will need a holding area big enough to hold almost two
|
|
|
|
copies of our largest string. */
|
1999-07-07 22:19:36 +02:00
|
|
|
swallowed_p = swallowed = alloca (max_length << 1);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* and a list of pointers to current scan points. */
|
1999-07-07 22:19:36 +02:00
|
|
|
plist = (char **) alloca (string_count * sizeof (*plist));
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* and initialize */
|
|
|
|
for (i = 0; i < string_count; ++i)
|
|
|
|
plist[i] = list[i];
|
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
for (ch = sr_readchar (); /* loop forever */ ; ch = sr_readchar ())
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
1999-07-07 22:19:36 +02:00
|
|
|
QUIT; /* Let user quit and leave process running */
|
1999-04-16 03:35:26 +02:00
|
|
|
ch_handled = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < string_count; ++i)
|
|
|
|
{
|
|
|
|
if (ch == *plist[i] || *plist[i] == '?')
|
|
|
|
{
|
|
|
|
++plist[i];
|
|
|
|
if (*plist[i] == '\0')
|
1999-07-07 22:19:36 +02:00
|
|
|
return (i);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
if (!ch_handled)
|
|
|
|
*swallowed_p++ = ch;
|
|
|
|
|
|
|
|
ch_handled = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
plist[i] = list[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ch_handled)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
/* Print out any characters which have been swallowed. */
|
|
|
|
if (passthrough)
|
|
|
|
{
|
|
|
|
for (p = swallowed; p < swallowed_p; ++p)
|
|
|
|
fputc_unfiltered (*p, gdb_stdout);
|
|
|
|
|
|
|
|
fputc_unfiltered (ch, gdb_stdout);
|
|
|
|
}
|
|
|
|
|
|
|
|
swallowed_p = swallowed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
/* Never reached. */
|
1999-07-07 22:19:36 +02:00
|
|
|
return (-1);
|
1999-04-16 03:35:26 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get ready to modify the registers array. On machines which store
|
|
|
|
individual registers, this doesn't need to do anything. On machines
|
|
|
|
which store all the registers in one fell swoop, this makes sure
|
|
|
|
that registers contains all the registers from the program being
|
|
|
|
debugged. */
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
gr_prepare_to_store (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
/* Do nothing, since we assume we can store individual regs */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-07-30 03:48:28 +02:00
|
|
|
_initialize_sr_support (void)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
/* FIXME-now: if target is open... */
|
2004-07-26 16:53:06 +02:00
|
|
|
deprecated_add_show_from_set
|
|
|
|
(add_set_cmd ("remotedevice", no_class,
|
|
|
|
var_filename, (char *) &sr_settings.device,
|
|
|
|
"Set device for remote serial I/O.\n\
|
1999-04-16 03:35:26 +02:00
|
|
|
This device is used as the serial port when debugging using remote\n\
|
|
|
|
targets.", &setlist),
|
2004-07-26 16:53:06 +02:00
|
|
|
&showlist);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
add_com ("remote <command>", class_obscure, sr_com,
|
|
|
|
"Send a command to the remote monitor.");
|
|
|
|
|
|
|
|
}
|