* remote.c, remote-mips.c: Use sr_get_debug not remote_debug.

This commit is contained in:
Jim Kingdon 1993-09-20 21:20:59 +00:00
parent 424ab390d6
commit 66a48870ac
3 changed files with 24 additions and 25 deletions

View file

@ -1,5 +1,7 @@
Mon Sep 20 14:53:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com) Mon Sep 20 14:53:11 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* remote.c, remote-mips.c: Use sr_get_debug not remote_debug.
* README: Say using bfd from another release doesn't generally work. * README: Say using bfd from another release doesn't generally work.
Sat Sep 18 10:13:18 1993 Jim Kingdon (kingdon@poseidon.cygnus.com) Sat Sep 18 10:13:18 1993 Jim Kingdon (kingdon@poseidon.cygnus.com)

View file

@ -28,6 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h" #include "gdbcore.h"
#include "serial.h" #include "serial.h"
#include "target.h" #include "target.h"
#include "remote-utils.h"
#include <signal.h> #include <signal.h>
@ -306,7 +307,7 @@ mips_readchar (timeout)
error ("End of file from remote"); error ("End of file from remote");
if (ch == SERIAL_ERROR) if (ch == SERIAL_ERROR)
error ("Error reading from remote: %s", safe_strerror (errno)); error ("Error reading from remote: %s", safe_strerror (errno));
if (remote_debug > 1) if (sr_get_debug () > 1)
{ {
if (ch != SERIAL_TIMEOUT) if (ch != SERIAL_TIMEOUT)
printf_filtered ("Read '%c' %d 0x%x\n", ch, ch, ch); printf_filtered ("Read '%c' %d 0x%x\n", ch, ch, ch);
@ -323,7 +324,7 @@ mips_readchar (timeout)
&& state == 5 && state == 5
&& ! mips_initializing) && ! mips_initializing)
{ {
if (remote_debug > 0) if (sr_get_debug () > 0)
printf_filtered ("Reinitializing MIPS debugging mode\n"); printf_filtered ("Reinitializing MIPS debugging mode\n");
SERIAL_WRITE (mips_desc, "\rdb tty0\r", sizeof "\rdb tty0\r" - 1); SERIAL_WRITE (mips_desc, "\rdb tty0\r", sizeof "\rdb tty0\r" - 1);
sleep (1); sleep (1);
@ -375,7 +376,7 @@ mips_receive_header (hdr, pgarbage, ch, timeout)
what the program is outputting, if the debugging is what the program is outputting, if the debugging is
being done on the console port. FIXME: Perhaps this being done on the console port. FIXME: Perhaps this
should be filtered? */ should be filtered? */
if (! mips_initializing || remote_debug > 0) if (! mips_initializing || sr_get_debug () > 0)
{ {
putchar (ch); putchar (ch);
fflush (stdout); fflush (stdout);
@ -510,7 +511,7 @@ mips_send_packet (s, get_ack)
int garbage; int garbage;
int ch; int ch;
if (remote_debug > 0) if (sr_get_debug () > 0)
{ {
packet[HDR_LENGTH + len + TRLR_LENGTH] = '\0'; packet[HDR_LENGTH + len + TRLR_LENGTH] = '\0';
printf_filtered ("Writing \"%s\"\n", packet + 1); printf_filtered ("Writing \"%s\"\n", packet + 1);
@ -566,7 +567,7 @@ mips_send_packet (s, get_ack)
!= TRLR_GET_CKSUM (trlr)) != TRLR_GET_CKSUM (trlr))
continue; continue;
if (remote_debug > 0) if (sr_get_debug () > 0)
{ {
hdr[HDR_LENGTH] = '\0'; hdr[HDR_LENGTH] = '\0';
trlr[TRLR_LENGTH] = '\0'; trlr[TRLR_LENGTH] = '\0';
@ -627,7 +628,7 @@ mips_receive_packet (buff)
/* An acknowledgement is probably a duplicate; ignore it. */ /* An acknowledgement is probably a duplicate; ignore it. */
if (! HDR_IS_DATA (hdr)) if (! HDR_IS_DATA (hdr))
{ {
if (remote_debug > 0) if (sr_get_debug () > 0)
printf_filtered ("Ignoring unexpected ACK\n"); printf_filtered ("Ignoring unexpected ACK\n");
continue; continue;
} }
@ -635,7 +636,7 @@ mips_receive_packet (buff)
/* If this is the wrong sequence number, ignore it. */ /* If this is the wrong sequence number, ignore it. */
if (HDR_GET_SEQ (hdr) != mips_receive_seq) if (HDR_GET_SEQ (hdr) != mips_receive_seq)
{ {
if (remote_debug > 0) if (sr_get_debug () > 0)
printf_filtered ("Ignoring sequence number %d (want %d)\n", printf_filtered ("Ignoring sequence number %d (want %d)\n",
HDR_GET_SEQ (hdr), mips_receive_seq); HDR_GET_SEQ (hdr), mips_receive_seq);
continue; continue;
@ -660,7 +661,7 @@ mips_receive_packet (buff)
if (i < len) if (i < len)
{ {
if (remote_debug > 0) if (sr_get_debug () > 0)
printf_filtered ("Got new SYN after %d chars (wanted %d)\n", printf_filtered ("Got new SYN after %d chars (wanted %d)\n",
i, len); i, len);
continue; continue;
@ -671,7 +672,7 @@ mips_receive_packet (buff)
error ("Timed out waiting for packet"); error ("Timed out waiting for packet");
if (err == -2) if (err == -2)
{ {
if (remote_debug > 0) if (sr_get_debug () > 0)
printf_filtered ("Got SYN when wanted trailer\n"); printf_filtered ("Got SYN when wanted trailer\n");
continue; continue;
} }
@ -679,7 +680,7 @@ mips_receive_packet (buff)
if (mips_cksum (hdr, buff, len) == TRLR_GET_CKSUM (trlr)) if (mips_cksum (hdr, buff, len) == TRLR_GET_CKSUM (trlr))
break; break;
if (remote_debug > 0) if (sr_get_debug () > 0)
printf_filtered ("Bad checksum; data %d, trailer %d\n", printf_filtered ("Bad checksum; data %d, trailer %d\n",
mips_cksum (hdr, buff, len), mips_cksum (hdr, buff, len),
TRLR_GET_CKSUM (trlr)); TRLR_GET_CKSUM (trlr));
@ -697,7 +698,7 @@ mips_receive_packet (buff)
ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum); ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum);
ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum); ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum);
if (remote_debug > 0) if (sr_get_debug () > 0)
{ {
ack[HDR_LENGTH + TRLR_LENGTH] = '\0'; ack[HDR_LENGTH + TRLR_LENGTH] = '\0';
printf_filtered ("Writing ack %d \"%s\"\n", mips_receive_seq, printf_filtered ("Writing ack %d \"%s\"\n", mips_receive_seq,
@ -708,7 +709,7 @@ mips_receive_packet (buff)
error ("write to target failed: %s", safe_strerror (errno)); error ("write to target failed: %s", safe_strerror (errno));
} }
if (remote_debug > 0) if (sr_get_debug () > 0)
{ {
buff[len] = '\0'; buff[len] = '\0';
printf_filtered ("Got packet \"%s\"\n", buff); printf_filtered ("Got packet \"%s\"\n", buff);
@ -728,7 +729,7 @@ mips_receive_packet (buff)
ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum); ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum);
ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum); ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum);
if (remote_debug > 0) if (sr_get_debug () > 0)
{ {
ack[HDR_LENGTH + TRLR_LENGTH] = '\0'; ack[HDR_LENGTH + TRLR_LENGTH] = '\0';
printf_filtered ("Writing ack %d \"%s\"\n", mips_receive_seq, printf_filtered ("Writing ack %d \"%s\"\n", mips_receive_seq,

View file

@ -221,10 +221,6 @@ static int timeout = 2;
int icache; int icache;
#endif #endif
/* FIXME: This is a hack which lets this file compile. It should be getting
this setting from remote-utils.c. */
#define remote_debug (0)
/* Descriptor for I/O to remote machine. Initialize it to NULL so that /* Descriptor for I/O to remote machine. Initialize it to NULL so that
remote_open knows that we don't have a file open when the program remote_open knows that we don't have a file open when the program
starts. */ starts. */
@ -409,7 +405,7 @@ remote_interrupt (signo)
/* If this doesn't work, try more severe steps. */ /* If this doesn't work, try more severe steps. */
signal (signo, remote_interrupt_twice); signal (signo, remote_interrupt_twice);
if (remote_debug) if (sr_get_debug ())
printf ("remote_interrupt called\n"); printf ("remote_interrupt called\n");
SERIAL_WRITE (remote_desc, "\003", 1); /* Send a ^C */ SERIAL_WRITE (remote_desc, "\003", 1); /* Send a ^C */
@ -933,7 +929,7 @@ putpkt (buf)
while (1) while (1)
{ {
if (remote_debug) if (sr_get_debug ())
{ {
*p = '\0'; *p = '\0';
printf ("Sending packet: %s...", buf2); fflush(stdout); printf ("Sending packet: %s...", buf2); fflush(stdout);
@ -949,7 +945,7 @@ putpkt (buf)
switch (ch) switch (ch)
{ {
case '+': case '+':
if (remote_debug) if (sr_get_debug ())
printf("Ack\n"); printf("Ack\n");
return; return;
case SERIAL_TIMEOUT: case SERIAL_TIMEOUT:
@ -959,7 +955,7 @@ putpkt (buf)
case SERIAL_EOF: case SERIAL_EOF:
error ("putpkt: EOF while trying to read ACK"); error ("putpkt: EOF while trying to read ACK");
default: default:
if (remote_debug) if (sr_get_debug ())
printf ("%02X %c ", ch&0xFF, ch); printf ("%02X %c ", ch&0xFF, ch);
continue; continue;
} }
@ -1000,7 +996,7 @@ getpkt (buf, forever)
if (forever) if (forever)
continue; continue;
if (++retries >= MAX_RETRIES) if (++retries >= MAX_RETRIES)
if (remote_debug) puts_filtered ("Timed out.\n"); if (sr_get_debug ()) puts_filtered ("Timed out.\n");
goto out; goto out;
} }
@ -1018,13 +1014,13 @@ getpkt (buf, forever)
c = readchar (); c = readchar ();
if (c == SERIAL_TIMEOUT) if (c == SERIAL_TIMEOUT)
{ {
if (remote_debug) if (sr_get_debug ())
puts_filtered ("Timeout in mid-packet, retrying\n"); puts_filtered ("Timeout in mid-packet, retrying\n");
goto whole; /* Start a new packet, count retries */ goto whole; /* Start a new packet, count retries */
} }
if (c == '$') if (c == '$')
{ {
if (remote_debug) if (sr_get_debug ())
puts_filtered ("Saw new packet start in middle of old one\n"); puts_filtered ("Saw new packet start in middle of old one\n");
goto whole; /* Start a new packet, count retries */ goto whole; /* Start a new packet, count retries */
} }
@ -1069,7 +1065,7 @@ out:
SERIAL_WRITE (remote_desc, "+", 1); SERIAL_WRITE (remote_desc, "+", 1);
if (remote_debug) if (sr_get_debug ())
fprintf (stderr,"Packet received: %s\n", buf); fprintf (stderr,"Packet received: %s\n", buf);
} }