This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
monitor.c cleanups ...
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: monitor.c cleanups ...
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Thu, 07 Oct 1999 20:47:55 +1000
- DJ-Gateway: from newsgroup cygnus.patches.gdb
- Newsgroups: cygnus.patches.gdb
- Organization: Cygnus Solutions
FYI,
The attatched cleans up monitor.c's debug/trace code and almost adds a
``set monitordebug'' command. Importantly it ensures that all debug
output goes to the correct place (make Insight happy :-).
If people see problems please let me know.
Andrew
Thu Oct 7 19:24:05 1999 Andrew Cagney <cagney@b1.cygnus.com>
* Makefile.in (monitor.o): Allow monitor.o to be compiled with
-Werror.
* monitor.c (monitor_debug_p): New variable. Replaces macro.
(EXTRA_RDEBUG): Delete. Update all uses.
(monitor_debug): New function. Replaces macro.
(RDEBUG): Delete macro. Update all uses.
debug output to gdb_stdlog and not the console.
* monitor.c: Fix printf formating. Replace printf calls with
fprintf_unfiltered.
Index: monitor.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/monitor.c,v
retrieving revision 1.105
retrieving revision 1.108
diff -p -r1.105 -r1.108
*** monitor.c 1999/09/04 02:05:26 1.105
--- monitor.c 1999/10/07 10:41:30 1.108
*************** static void (*ofunc) (); /* Old SIGINT s
*** 116,127 ****
static CORE_ADDR *breakaddr;
- /* Extra remote debugging for developing a new rom monitor variation */
- #if ! defined(EXTRA_RDEBUG)
- #define EXTRA_RDEBUG 0
- #endif
- #define RDEBUG(stuff) { if (EXTRA_RDEBUG && remote_debug) printf stuff ; }
-
/* 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
program starts. */
--- 116,121 ----
*************** static int first_time = 0; /* is this th
*** 145,150 ****
--- 139,168 ----
#define TARGET_BUF_SIZE 2048
+ /* Monitor specific debugging information. Typically only useful to
+ the developer of a new monitor interface. */
+
+ static void monitor_debug (const char *fmt, ...) ATTR_FORMAT(printf, 1, 2);
+
+ static int monitor_debug_p = 0;
+
+ /* NOTE: This file alternates between monitor_debug_p and remote_debug
+ when determining if debug information is printed. Perhaphs this
+ could be simplified. */
+
+ static void
+ monitor_debug (const char *fmt, ...)
+ {
+ if (monitor_debug_p)
+ {
+ va_list args;
+ va_start (args, fmt);
+ vfprintf_filtered (gdb_stdlog, fmt, args);
+ va_end (args);
+ }
+ }
+
+
/* Convert a string into a printable representation, Return # byte in the
new string. */
*************** monitor_printf_noecho (char *pattern,...
*** 330,345 ****
if (len + 1 > sizeof sndbuf)
abort ();
! #if 0
! if (remote_debug > 0)
! puts_debug ("sent -->", sndbuf, "<--");
! #endif
! if (EXTRA_RDEBUG
! && remote_debug)
{
char *safe_string = (char *) alloca ((strlen (sndbuf) * 4) + 1);
monitor_printable_string (safe_string, sndbuf);
! printf ("sent[%s]\n", safe_string);
}
monitor_write (sndbuf, len);
--- 348,358 ----
if (len + 1 > sizeof sndbuf)
abort ();
! if (monitor_debug_p)
{
char *safe_string = (char *) alloca ((strlen (sndbuf) * 4) + 1);
monitor_printable_string (safe_string, sndbuf);
! fprintf_unfiltered (gdb_stdlog, "sent[%s]\n", safe_string);
}
monitor_write (sndbuf, len);
*************** monitor_printf (char *pattern,...)
*** 363,378 ****
if (len + 1 > sizeof sndbuf)
abort ();
! #if 0
! if (remote_debug > 0)
! puts_debug ("sent -->", sndbuf, "<--");
! #endif
! if (EXTRA_RDEBUG
! && remote_debug)
{
char *safe_string = (char *) alloca ((len * 4) + 1);
monitor_printable_string (safe_string, sndbuf);
! printf ("sent[%s]\n", safe_string);
}
monitor_write (sndbuf, len);
--- 376,386 ----
if (len + 1 > sizeof sndbuf)
abort ();
! if (monitor_debug_p)
{
char *safe_string = (char *) alloca ((len * 4) + 1);
monitor_printable_string (safe_string, sndbuf);
! fprintf_unfiltered (gdb_stdlog, "sent[%s]\n", safe_string);
}
monitor_write (sndbuf, len);
*************** monitor_printf (char *pattern,...)
*** 381,388 ****
just output, but sometimes some extra junk appeared before the characters
we expected, like an extra prompt, or a portmaster sending telnet negotiations.
So, just start searching for what we sent, and skip anything unknown. */
! RDEBUG (("ExpectEcho\n"))
! monitor_expect (sndbuf, (char *) 0, 0);
}
--- 389,396 ----
just output, but sometimes some extra junk appeared before the characters
we expected, like an extra prompt, or a portmaster sending telnet negotiations.
So, just start searching for what we sent, and skip anything unknown. */
! monitor_debug ("ExpectEcho\n");
! monitor_expect (sndbuf, (char *) 0, 0);
}
*************** readchar (timeout)
*** 454,460 ****
c &= 0x7f;
/* This seems to interfere with proper function of the
input stream */
! if (remote_debug > 0)
{
char buf[2];
buf[0] = c;
--- 462,468 ----
c &= 0x7f;
/* This seems to interfere with proper function of the
input stream */
! if (monitor_debug_p || remote_debug)
{
char buf[2];
buf[0] = c;
*************** monitor_expect (string, buf, buflen)
*** 522,533 ****
int c;
extern struct target_ops *targ_ops;
! if (EXTRA_RDEBUG
! && remote_debug)
{
char *safe_string = (char *) alloca ((strlen (string) * 4) + 1);
monitor_printable_string (safe_string, string);
! printf ("MON Expecting '%s'\n", safe_string);
}
immediate_quit = 1;
--- 530,540 ----
int c;
extern struct target_ops *targ_ops;
! if (monitor_debug_p)
{
char *safe_string = (char *) alloca ((strlen (string) * 4) + 1);
monitor_printable_string (safe_string, string);
! fprintf_unfiltered (gdb_stdlog, "MON Expecting '%s'\n", safe_string);
}
immediate_quit = 1;
*************** monitor_expect_regexp (pat, buf, buflen)
*** 628,634 ****
{
char *mybuf;
char *p;
! RDEBUG (("MON Expecting regexp\n"));
if (buf)
mybuf = buf;
else
--- 635,641 ----
{
char *mybuf;
char *p;
! monitor_debug ("MON Expecting regexp\n");
if (buf)
mybuf = buf;
else
*************** monitor_expect_prompt (buf, buflen)
*** 679,686 ****
char *buf;
int buflen;
{
! RDEBUG (("MON Expecting prompt\n"))
! return monitor_expect (current_monitor->prompt, buf, buflen);
}
/* Get N 32-bit words from remote, each preceded by a space, and put
--- 686,693 ----
char *buf;
int buflen;
{
! monitor_debug ("MON Expecting prompt\n");
! return monitor_expect (current_monitor->prompt, buf, buflen);
}
/* Get N 32-bit words from remote, each preceded by a space, and put
*************** monitor_open (args, mon_ops, from_tty)
*** 808,814 ****
monitor_stop ();
if ((current_monitor->flags & MO_NO_ECHO_ON_OPEN) == 0)
{
! RDEBUG (("EXP Open echo\n"));
monitor_expect_prompt (NULL, 0);
}
}
--- 815,821 ----
monitor_stop ();
if ((current_monitor->flags & MO_NO_ECHO_ON_OPEN) == 0)
{
! monitor_debug ("EXP Open echo\n");
monitor_expect_prompt (NULL, 0);
}
}
*************** monitor_supply_register (regno, valstr)
*** 930,936 ****
val <<= 4;
val += fromhex (*p++);
}
! RDEBUG (("Supplying Register %d %s\n", regno, valstr));
if (*p != '\0')
error ("monitor_supply_register (%d): bad value from monitor: %s.",
--- 937,943 ----
val <<= 4;
val += fromhex (*p++);
}
! monitor_debug ("Supplying Register %d %s\n", regno, valstr);
if (*p != '\0')
error ("monitor_supply_register (%d): bad value from monitor: %s.",
*************** monitor_resume (pid, step, sig)
*** 959,965 ****
enum target_signal sig;
{
/* Some monitors require a different command when starting a program */
! RDEBUG (("MON resume\n"));
if (current_monitor->flags & MO_RUN_FIRST_TIME && first_time == 1)
{
first_time = 0;
--- 966,972 ----
enum target_signal sig;
{
/* Some monitors require a different command when starting a program */
! monitor_debug ("MON resume\n");
if (current_monitor->flags & MO_RUN_FIRST_TIME && first_time == 1)
{
first_time = 0;
*************** parse_register_dump (buf, len)
*** 992,999 ****
char *buf;
int len;
{
! RDEBUG (("MON Parsing register dump\n"))
! while (1)
{
int regnamelen, vallen;
char *regname, *val;
--- 999,1006 ----
char *buf;
int len;
{
! monitor_debug ("MON Parsing register dump\n");
! while (1)
{
int regnamelen, vallen;
char *regname, *val;
*************** monitor_interrupt (signo)
*** 1029,1036 ****
/* 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 ();
}
--- 1036,1043 ----
/* If this doesn't work, try more severe steps. */
signal (signo, monitor_interrupt_twice);
! if (monitor_debug_p || remote_debug)
! fprintf_unfiltered (gdb_stdlog, "monitor_interrupt called\n");
target_stop ();
}
*************** monitor_wait_filter (char *buf,
*** 1096,1103 ****
/* Print any output characters that were preceded by ^O. */
/* FIXME - This would be great as a user settabgle flag */
! if (remote_debug ||
! current_monitor->flags & MO_PRINT_PROGRAM_OUTPUT)
{
int i;
--- 1103,1110 ----
/* Print any output characters that were preceded by ^O. */
/* FIXME - This would be great as a user settabgle flag */
! if (monitor_debug_p || remote_debug
! || current_monitor->flags & MO_PRINT_PROGRAM_OUTPUT)
{
int i;
*************** monitor_wait (pid, status)
*** 1126,1139 ****
status->value.integer = 0;
old_chain = make_cleanup (monitor_wait_cleanup, &old_timeout);
! RDEBUG (("MON wait\n"))
#if 0
/* This is somthing other than a maintenance command */
in_monitor_wait = 1;
timeout = watchdog > 0 ? watchdog : -1;
#else
! timeout = -1; /* Don't time out -- user program is running. */
#endif
ofunc = (void (*)()) signal (SIGINT, monitor_interrupt);
--- 1133,1146 ----
status->value.integer = 0;
old_chain = make_cleanup (monitor_wait_cleanup, &old_timeout);
! monitor_debug ("MON wait\n");
#if 0
/* This is somthing other than a maintenance command */
in_monitor_wait = 1;
timeout = watchdog > 0 ? watchdog : -1;
#else
! timeout = -1; /* Don't time out -- user program is running. */
#endif
ofunc = (void (*)()) signal (SIGINT, monitor_interrupt);
*************** monitor_wait (pid, status)
*** 1155,1162 ****
/* Print any output characters that were preceded by ^O. */
/* FIXME - This would be great as a user settabgle flag */
! if (remote_debug ||
! current_monitor->flags & MO_PRINT_PROGRAM_OUTPUT)
{
int i;
--- 1162,1169 ----
/* Print any output characters that were preceded by ^O. */
/* FIXME - This would be great as a user settabgle flag */
! if (monitor_debug_p || remote_debug
! || current_monitor->flags & MO_PRINT_PROGRAM_OUTPUT)
{
int i;
*************** monitor_wait (pid, status)
*** 1180,1186 ****
if (current_monitor->register_pattern)
parse_register_dump (buf, resp_len);
#else
! RDEBUG (("Wait fetching registers after stop\n"));
monitor_dump_regs ();
#endif
--- 1187,1193 ----
if (current_monitor->register_pattern)
parse_register_dump (buf, resp_len);
#else
! monitor_debug ("Wait fetching registers after stop\n");
monitor_dump_regs ();
#endif
*************** monitor_fetch_register (regno)
*** 1208,1219 ****
int i;
name = current_monitor->regnames[regno];
! RDEBUG (("MON fetchreg %d '%s'\n", regno, name ? name : "(null name)"))
! if (!name || (*name == '\0'))
{
! RDEBUG (("No register known for %d\n", regno))
! supply_register (regno, zerobuf);
return;
}
--- 1215,1226 ----
int i;
name = current_monitor->regnames[regno];
! monitor_debug ("MON fetchreg %d '%s'\n", regno, name ? name : "(null name)");
! if (!name || (*name == '\0'))
{
! monitor_debug ("No register known for %d\n", regno);
! supply_register (regno, zerobuf);
return;
}
*************** monitor_fetch_register (regno)
*** 1227,1239 ****
if (current_monitor->getreg.resp_delim)
{
! RDEBUG (("EXP getreg.resp_delim\n"))
! monitor_expect (current_monitor->getreg.resp_delim, NULL, 0);
/* Handle case of first 32 registers listed in pairs. */
if (current_monitor->flags & MO_32_REGS_PAIRED
&& (regno & 1) != 0 && regno < 32)
{
! RDEBUG (("EXP getreg.resp_delim\n"));
monitor_expect (current_monitor->getreg.resp_delim, NULL, 0);
}
}
--- 1234,1246 ----
if (current_monitor->getreg.resp_delim)
{
! monitor_debug ("EXP getreg.resp_delim\n");
! monitor_expect (current_monitor->getreg.resp_delim, NULL, 0);
/* Handle case of first 32 registers listed in pairs. */
if (current_monitor->flags & MO_32_REGS_PAIRED
&& (regno & 1) != 0 && regno < 32)
{
! monitor_debug ("EXP getreg.resp_delim\n");
monitor_expect (current_monitor->getreg.resp_delim, NULL, 0);
}
}
*************** monitor_fetch_register (regno)
*** 1270,1276 ****
}
regbuf[i] = '\000'; /* terminate the number */
! RDEBUG (("REGVAL '%s'\n", regbuf));
/* 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
--- 1277,1283 ----
}
regbuf[i] = '\000'; /* terminate the number */
! monitor_debug ("REGVAL '%s'\n", regbuf);
/* 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
*************** monitor_fetch_register (regno)
*** 1279,1292 ****
if (current_monitor->getreg.term)
{
! RDEBUG (("EXP getreg.term\n"))
! monitor_expect (current_monitor->getreg.term, NULL, 0); /* get response */
}
if (current_monitor->getreg.term_cmd)
{
! RDEBUG (("EMIT getreg.term.cmd\n"))
! monitor_printf (current_monitor->getreg.term_cmd);
}
if (!current_monitor->getreg.term || /* Already expected or */
current_monitor->getreg.term_cmd) /* ack expected */
--- 1286,1299 ----
if (current_monitor->getreg.term)
{
! monitor_debug ("EXP getreg.term\n");
! monitor_expect (current_monitor->getreg.term, NULL, 0); /* get response */
}
if (current_monitor->getreg.term_cmd)
{
! monitor_debug ("EMIT getreg.term.cmd\n");
! monitor_printf (current_monitor->getreg.term_cmd);
}
if (!current_monitor->getreg.term || /* Already expected or */
current_monitor->getreg.term_cmd) /* ack expected */
*************** static void
*** 1335,1341 ****
monitor_fetch_registers (regno)
int regno;
{
! RDEBUG (("MON fetchregs\n"));
if (current_monitor->getreg.cmd)
{
if (regno >= 0)
--- 1342,1348 ----
monitor_fetch_registers (regno)
int regno;
{
! monitor_debug ("MON fetchregs\n");
if (current_monitor->getreg.cmd)
{
if (regno >= 0)
*************** monitor_store_register (regno)
*** 1365,1380 ****
name = current_monitor->regnames[regno];
if (!name || (*name == '\0'))
{
! RDEBUG (("MON Cannot store unknown register\n"))
! return;
}
val = read_register (regno);
! RDEBUG (("MON storeg %d %08lx\n", regno, (ULONGEST) val))
/* send the register deposit command */
! if (current_monitor->flags & MO_REGISTER_VALUE_FIRST)
monitor_printf (current_monitor->setreg.cmd, val, name);
else if (current_monitor->flags & MO_SETREG_INTERACTIVE)
monitor_printf (current_monitor->setreg.cmd, name);
--- 1372,1387 ----
name = current_monitor->regnames[regno];
if (!name || (*name == '\0'))
{
! monitor_debug ("MON Cannot store unknown register\n");
! return;
}
val = read_register (regno);
! monitor_debug ("MON storeg %d %s\n", regno, preg (val));
/* send the register deposit command */
! if (current_monitor->flags & MO_REGISTER_VALUE_FIRST)
monitor_printf (current_monitor->setreg.cmd, val, name);
else if (current_monitor->flags & MO_SETREG_INTERACTIVE)
monitor_printf (current_monitor->setreg.cmd, name);
*************** monitor_store_register (regno)
*** 1383,1399 ****
if (current_monitor->setreg.term)
{
! RDEBUG (("EXP setreg.term\n"))
! monitor_expect (current_monitor->setreg.term, NULL, 0);
if (current_monitor->flags & MO_SETREG_INTERACTIVE)
! monitor_printf ("%A\r", val);
monitor_expect_prompt (NULL, 0);
}
else
monitor_expect_prompt (NULL, 0);
if (current_monitor->setreg.term_cmd) /* Mode exit required */
{
! RDEBUG (("EXP setreg_termcmd\n"));
monitor_printf ("%s", current_monitor->setreg.term_cmd);
monitor_expect_prompt (NULL, 0);
}
--- 1390,1406 ----
if (current_monitor->setreg.term)
{
! monitor_debug ("EXP setreg.term\n");
! monitor_expect (current_monitor->setreg.term, NULL, 0);
if (current_monitor->flags & MO_SETREG_INTERACTIVE)
! monitor_printf ("%s\r", paddr_nz (val));
monitor_expect_prompt (NULL, 0);
}
else
monitor_expect_prompt (NULL, 0);
if (current_monitor->setreg.term_cmd) /* Mode exit required */
{
! monitor_debug ("EXP setreg_termcmd\n");
monitor_printf ("%s", current_monitor->setreg.term_cmd);
monitor_expect_prompt (NULL, 0);
}
*************** monitor_write_memory (memaddr, myaddr, l
*** 1444,1452 ****
char *cmd;
int i;
! RDEBUG (("MON write %d %08x\n", len, (unsigned long) memaddr))
! if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
memaddr = ADDR_BITS_REMOVE (memaddr);
/* Use memory fill command for leading 0 bytes. */
--- 1451,1459 ----
char *cmd;
int i;
! monitor_debug ("MON write %d %s\n", len, paddr (memaddr));
! if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
memaddr = ADDR_BITS_REMOVE (memaddr);
/* Use memory fill command for leading 0 bytes. */
*************** monitor_write_memory (memaddr, myaddr, l
*** 1459,1466 ****
if (i > 4) /* More than 4 zeros is worth doing */
{
! RDEBUG (("MON FILL %d\n", i))
! if (current_monitor->flags & MO_FILL_USES_ADDR)
monitor_printf (current_monitor->fill, memaddr, (memaddr + i) - 1, 0);
else
monitor_printf (current_monitor->fill, memaddr, i, 0);
--- 1466,1473 ----
if (i > 4) /* More than 4 zeros is worth doing */
{
! monitor_debug ("MON FILL %d\n", i);
! if (current_monitor->flags & MO_FILL_USES_ADDR)
monitor_printf (current_monitor->fill, memaddr, (memaddr + i) - 1, 0);
else
monitor_printf (current_monitor->fill, memaddr, i, 0);
*************** monitor_write_memory (memaddr, myaddr, l
*** 1501,1507 ****
if (len == 4)
{
hostval = *(unsigned int *) myaddr;
! RDEBUG (("Hostval(%08x) val(%08x)\n", hostval, val));
}
--- 1508,1514 ----
if (len == 4)
{
hostval = *(unsigned int *) myaddr;
! monitor_debug ("Hostval(%08x) val(%08x)\n", hostval, val);
}
*************** monitor_write_memory (memaddr, myaddr, l
*** 1514,1520 ****
if (current_monitor->setmem.term)
{
! RDEBUG (("EXP setmem.term"));
monitor_expect (current_monitor->setmem.term, NULL, 0);
monitor_printf ("%x\r", val);
}
--- 1521,1527 ----
if (current_monitor->setmem.term)
{
! monitor_debug ("EXP setmem.term");
monitor_expect (current_monitor->setmem.term, NULL, 0);
monitor_printf ("%x\r", val);
}
*************** monitor_write_even_block (memaddr, myadd
*** 1552,1560 ****
myaddr += 4;
memaddr += 4;
written += 4;
! RDEBUG ((" @ %08x\n", memaddr))
/* If we wanted to, here we could validate the address */
! monitor_expect_prompt (NULL, 0);
}
/* Now exit the sub mode */
monitor_printf (current_monitor->getreg.term_cmd);
--- 1559,1567 ----
myaddr += 4;
memaddr += 4;
written += 4;
! monitor_debug (" @ %s\n", paddr (memaddr));
/* If we wanted to, here we could validate the address */
! monitor_expect_prompt (NULL, 0);
}
/* Now exit the sub mode */
monitor_printf (current_monitor->getreg.term_cmd);
*************** monitor_read_memory_single (memaddr, mya
*** 1754,1760 ****
char *cmd;
int i;
! RDEBUG (("MON read single\n"));
#if 0
/* Can't actually use long longs (nice idea, though). In fact, the
call to strtoul below will fail if it tries to convert a value
--- 1761,1767 ----
char *cmd;
int i;
! monitor_debug ("MON read single\n");
#if 0
/* Can't actually use long longs (nice idea, though). In fact, the
call to strtoul below will fail if it tries to convert a value
*************** monitor_read_memory_single (memaddr, mya
*** 1792,1798 ****
if (current_monitor->getmem.resp_delim)
{
! RDEBUG (("EXP getmem.resp_delim\n"));
monitor_expect_regexp (&getmem_resp_delim_pattern, NULL, 0);
}
--- 1799,1805 ----
if (current_monitor->getmem.resp_delim)
{
! monitor_debug ("EXP getmem.resp_delim\n");
monitor_expect_regexp (&getmem_resp_delim_pattern, NULL, 0);
}
*************** monitor_read_memory (memaddr, myaddr, le
*** 1884,1896 ****
if (len <= 0)
{
! RDEBUG (("Zero length call to monitor_read_memory\n"));
return 0;
}
! if (remote_debug)
! printf ("MON read block ta(%08x) ha(%08x) %d\n",
! (unsigned long) memaddr, (unsigned long) myaddr, len);
if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
memaddr = ADDR_BITS_REMOVE (memaddr);
--- 1891,1902 ----
if (len <= 0)
{
! monitor_debug ("Zero length call to monitor_read_memory\n");
return 0;
}
! monitor_debug ("MON read block ta(%s) ha(%lx) %d\n",
! paddr_nz (memaddr), (long) myaddr, len);
if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
memaddr = ADDR_BITS_REMOVE (memaddr);
*************** monitor_read_memory (memaddr, myaddr, le
*** 1954,1960 ****
{
int retval, tmp;
struct re_registers resp_strings;
! RDEBUG (("MON getmem.resp_delim %s\n", current_monitor->getmem.resp_delim));
memset (&resp_strings, 0, sizeof (struct re_registers));
tmp = strlen (p);
--- 1960,1966 ----
{
int retval, tmp;
struct re_registers resp_strings;
! monitor_debug ("MON getmem.resp_delim %s\n", current_monitor->getmem.resp_delim);
memset (&resp_strings, 0, sizeof (struct re_registers));
tmp = strlen (p);
*************** monitor_read_memory (memaddr, myaddr, le
*** 1974,1981 ****
p += strlen (current_monitor->getmem.resp_delim);
#endif
}
! if (remote_debug)
! printf ("MON scanning %d ,%08x '%s'\n", len, p, p);
if (current_monitor->flags & MO_GETMEM_16_BOUNDARY)
{
char c;
--- 1980,1986 ----
p += strlen (current_monitor->getmem.resp_delim);
#endif
}
! monitor_debug ("MON scanning %d ,%lx '%s'\n", len, (long) p, p);
if (current_monitor->flags & MO_GETMEM_16_BOUNDARY)
{
char c;
*************** monitor_read_memory (memaddr, myaddr, le
*** 1992,1999 ****
{
val = fromhex (c) * 16 + fromhex (*(p + 1));
*myaddr++ = val;
! if (remote_debug)
! printf ("[%02x]", val);
--i;
fetched++;
}
--- 1997,2004 ----
{
val = fromhex (c) * 16 + fromhex (*(p + 1));
*myaddr++ = val;
! if (monitor_debug_p || remote_debug)
! fprintf_unfiltered (gdb_stdlog, "[%02x]", val);
--i;
fetched++;
}
*************** monitor_read_memory (memaddr, myaddr, le
*** 2005,2015 ****
}
if (fetched == 0)
error ("Failed to read via monitor");
! if (remote_debug)
! printf ("\n");
return fetched; /* Return the number of bytes actually read */
}
! RDEBUG (("MON scanning bytes\n"));
for (i = len; i > 0; i--)
{
--- 2010,2020 ----
}
if (fetched == 0)
error ("Failed to read via monitor");
! if (monitor_debug_p || remote_debug)
! fprintf_unfiltered (gdb_stdlog, "\n");
return fetched; /* Return the number of bytes actually read */
}
! monitor_debug ("MON scanning bytes\n");
for (i = len; i > 0; i--)
{
*************** monitor_insert_breakpoint (addr, shadow)
*** 2100,2107 ****
unsigned char *bp;
int bplen;
! RDEBUG (("MON inst bkpt %08x\n", addr))
! if (current_monitor->set_break == NULL)
error ("No set_break defined for this monitor");
if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
--- 2105,2112 ----
unsigned char *bp;
int bplen;
! monitor_debug ("MON inst bkpt %s\n", paddr (addr));
! if (current_monitor->set_break == NULL)
error ("No set_break defined for this monitor");
if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
*************** monitor_remove_breakpoint (addr, shadow)
*** 2134,2141 ****
{
int i;
! RDEBUG (("MON rmbkpt %08x\n", addr))
! if (current_monitor->clr_break == NULL)
error ("No clr_break defined for this monitor");
if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
--- 2139,2146 ----
{
int i;
! monitor_debug ("MON rmbkpt %s\n", paddr (addr));
! if (current_monitor->clr_break == NULL)
error ("No clr_break defined for this monitor");
if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
*************** monitor_remove_breakpoint (addr, shadow)
*** 2158,2164 ****
}
}
fprintf_unfiltered (gdb_stderr,
! "Can't find breakpoint associated with 0x%x\n", addr);
return 1;
}
--- 2163,2170 ----
}
}
fprintf_unfiltered (gdb_stderr,
! "Can't find breakpoint associated with 0x%s\n",
! paddr_nz (addr));
return 1;
}
*************** monitor_load (file, from_tty)
*** 2197,2205 ****
int from_tty;
{
dcache_flush (remote_dcache);
! RDEBUG (("MON load\n"))
! if (current_monitor->load_routine)
current_monitor->load_routine (monitor_desc, file, hashmark);
else
{ /* The default is ascii S-records */
--- 2203,2211 ----
int from_tty;
{
dcache_flush (remote_dcache);
! monitor_debug ("MON load\n");
! if (current_monitor->load_routine)
current_monitor->load_routine (monitor_desc, file, hashmark);
else
{ /* The default is ascii S-records */
*************** monitor_load (file, from_tty)
*** 2245,2251 ****
static void
monitor_stop ()
{
! RDEBUG (("MON stop\n"));
if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
SERIAL_SEND_BREAK (monitor_desc);
if (current_monitor->stop)
--- 2251,2257 ----
static void
monitor_stop ()
{
! monitor_debug ("MON stop\n");
if ((current_monitor->flags & MO_SEND_BREAK_ON_STOP) != 0)
SERIAL_SEND_BREAK (monitor_desc);
if (current_monitor->stop)
*************** _initialize_remote_monitors ()
*** 2398,2401 ****
--- 2404,2419 ----
When enabled, a hashmark \'#\' is displayed.",
&setlist),
&showlist);
+
+ #if 0
+ /* FIXME: cagney/1999-10-07: Wait until there is a generic ``set
+ debug ...'' rather than another ``set ...debug'' command. */
+ add_show_from_set
+ (add_set_cmd ("monitordebug", no_class, var_zinteger,
+ (char *) &monitor_debug_p,
+ "Set debugging of remote monitor communication.\n\
+ When enabled, communication between GDB and the remote monitor\n\
+ is displayed.", &setlist),
+ &showlist);
+ #endif
}