#endif /* not __STDC__ */
-/* To be silent, or to loudly echo all input and output to and from
- the target. */
-
-static int bug88k_snoop = 0;
-
/* This is the serial descriptor to our target. */
static serial_t desc = NULL;
if (buf == SERIAL_TIMEOUT)
error ("Timeout reading from remote system.");
- if (bug88k_snoop)
+ if (remote_debug)
printf ("%c", buf);
return buf & 0x7f;
buf = SERIAL_READCHAR (desc, timeout);
if (buf == SERIAL_TIMEOUT)
buf = 0;
- if (bug88k_snoop)
+ if (remote_debug)
if (buf)
printf ("%c", buf);
else
buf = SERIAL_READCHAR (desc, 0);
if (buf == SERIAL_TIMEOUT)
buf = 0;
- if (bug88k_snoop)
+ if (remote_debug)
if (buf)
printf ("%c", buf);
else
SERIAL_WRITE (desc, a, l);
- if (bug88k_snoop)
+ if (remote_debug)
for (i = 0; i < l; i++)
{
printf ("%c", a[i]);
if (srec_echo_pace)
for (p = s; *p; ++p)
{
- if (bug88k_snoop)
+ if (remote_debug)
printf ("%c", *p);
do
if (retries > 0)
{
- if (bug88k_snoop)
+ if (remote_debug)
printf("\n<retrying...>\n");
/* This expect_prompt call is extremely important. Without
if ((x = pollchar()) != 0)
{
- if (bug88k_snoop)
+ if (remote_debug)
printf("\n<retrying...>\n");
++retries;
&setlist),
&showlist);
- add_show_from_set
- (add_set_cmd ("bug88k-snoop", class_support, var_boolean,
- (char *) &bug88k_snoop,
- "\
-Set echoing of what's going to and from the monitor.\n\
-When on, echo data going out on and coming back from the serial line.",
- &setlist),
- &showlist);
-
dev_name = NULL;
}
a reply. */
static int mips_need_reply = 0;
-/* This can be set to get debugging with ``set remotedebug''. */
-static int mips_debug = 0;
-
/* Handle used to access serial I/O stream. */
static serial_t mips_desc;
error ("End of file from remote");
if (ch == SERIAL_ERROR)
error ("Error reading from remote: %s", safe_strerror (errno));
- if (mips_debug > 1)
+ if (remote_debug > 1)
{
if (ch != SERIAL_TIMEOUT)
printf_filtered ("Read '%c' %d 0x%x\n", ch, ch, ch);
&& state == 5
&& ! mips_initializing)
{
- if (mips_debug > 0)
+ if (remote_debug > 0)
printf_filtered ("Reinitializing MIPS debugging mode\n");
SERIAL_WRITE (mips_desc, "\rdb tty0\r", sizeof "\rdb tty0\r" - 1);
sleep (1);
what the program is outputting, if the debugging is
being done on the console port. FIXME: Perhaps this
should be filtered? */
- if (! mips_initializing || mips_debug > 0)
+ if (! mips_initializing || remote_debug > 0)
{
putchar (ch);
fflush (stdout);
int garbage;
int ch;
- if (mips_debug > 0)
+ if (remote_debug > 0)
{
packet[HDR_LENGTH + len + TRLR_LENGTH] = '\0';
printf_filtered ("Writing \"%s\"\n", packet + 1);
!= TRLR_GET_CKSUM (trlr))
continue;
- if (mips_debug > 0)
+ if (remote_debug > 0)
{
hdr[HDR_LENGTH] = '\0';
trlr[TRLR_LENGTH] = '\0';
/* An acknowledgement is probably a duplicate; ignore it. */
if (! HDR_IS_DATA (hdr))
{
- if (mips_debug > 0)
+ if (remote_debug > 0)
printf_filtered ("Ignoring unexpected ACK\n");
continue;
}
/* If this is the wrong sequence number, ignore it. */
if (HDR_GET_SEQ (hdr) != mips_receive_seq)
{
- if (mips_debug > 0)
+ if (remote_debug > 0)
printf_filtered ("Ignoring sequence number %d (want %d)\n",
HDR_GET_SEQ (hdr), mips_receive_seq);
continue;
if (i < len)
{
- if (mips_debug > 0)
+ if (remote_debug > 0)
printf_filtered ("Got new SYN after %d chars (wanted %d)\n",
i, len);
continue;
error ("Timed out waiting for packet");
if (err == -2)
{
- if (mips_debug > 0)
+ if (remote_debug > 0)
printf_filtered ("Got SYN when wanted trailer\n");
continue;
}
if (mips_cksum (hdr, buff, len) == TRLR_GET_CKSUM (trlr))
break;
- if (mips_debug > 0)
+ if (remote_debug > 0)
printf_filtered ("Bad checksum; data %d, trailer %d\n",
mips_cksum (hdr, buff, len),
TRLR_GET_CKSUM (trlr));
ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum);
ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum);
- if (mips_debug > 0)
+ if (remote_debug > 0)
{
ack[HDR_LENGTH + TRLR_LENGTH] = '\0';
printf_filtered ("Writing ack %d \"%s\"\n", mips_receive_seq,
error ("write to target failed: %s", safe_strerror (errno));
}
- if (mips_debug > 0)
+ if (remote_debug > 0)
{
buff[len] = '\0';
printf_filtered ("Got packet \"%s\"\n", buff);
ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum);
ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum);
- if (mips_debug > 0)
+ if (remote_debug > 0)
{
ack[HDR_LENGTH + TRLR_LENGTH] = '\0';
printf_filtered ("Writing ack %d \"%s\"\n", mips_receive_seq,
This is the number of seconds to wait for an acknowledgement to a packet\n\
before resending the packet.", &setlist),
&showlist);
-
- add_show_from_set (
- add_set_cmd ("remotedebug", no_class, var_zinteger, (char *) &mips_debug,
- "Set debugging of remote MIPS serial I/O.\n\
-When non-zero, each packet sent or received with the remote target\n\
-is displayed. Higher numbers produce more debugging.", &setlist),
- &showlist);
}