Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "J.T. Conklin" <jtc@redbacknetworks.com>
To: gdb-patches@cygnus.com
Subject: stub putDebugChar cleanup
Date: Thu, 03 Dec 1998 11:53:00 -0000	[thread overview]
Message-ID: <199812031953.LAA12865@jtc.redbacknetworks.com> (raw)

The enclosed change modifies the provided stubs so that putDebugChar()
is declared as a void function as described in the documentation, and
fixes the stubs where putpacket() erroneously treated putDebugChar()'s
return value as an int.  This once bit me when interfacing the i386
stub into a system and I implemented putDebugChar() to the documented
specification.

(Another way to fix the ambiguity would have been to change the spec
so that putDebugChar would return success/failure.  However, it's not
clear to me what the stub can reasonably do in such a situation.  As
it is now, the packet will be munged by the dropped character(s), and
the protocol will recover fairly robustly).

    --jtc
 
1998-12-03  J.T. Conklin  <jtc@redbacknetworks.com>

	* i386-stub.c, m32r-stub.c, m68k-stub.c, sh-stub.c, sparc-stub.c,
	sparcl-stub, sparclet-stub.c: Changed declaration of putDebugChar
	to include explicit void return type as per documentation.  Fixed
	up occasions where stubs erroneously checked return type.


Index: i386-stub.c
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/i386-stub.c,v
retrieving revision 1.2
diff -c -r1.2 i386-stub.c
*** i386-stub.c	1998/12/03 01:00:06	1.2
--- i386-stub.c	1998/12/03 19:25:47
***************
*** 100,107 ****
  typedef void (*ExceptionHook)(int);   /* pointer to function with int parm */
  typedef void (*Function)();           /* pointer to a function */
  
! extern putDebugChar();   /* write a single character      */
! extern getDebugChar();   /* read and return a single char */
  
  extern Function exceptionHandler();  /* assign an exception handler */
  extern ExceptionHook exceptionHook;  /* hook variable for errors/exceptions */
--- 100,107 ----
  typedef void (*ExceptionHook)(int);   /* pointer to function with int parm */
  typedef void (*Function)();           /* pointer to a function */
  
! extern void putDebugChar();	/* write a single character      */
! extern int getDebugChar();	/* read and return a single char */
  
  extern Function exceptionHandler();  /* assign an exception handler */
  extern ExceptionHook exceptionHook;  /* hook variable for errors/exceptions */
***************
*** 527,533 ****
    count    = 0;
  
    while (ch=buffer[count]) {
!     if (! putDebugChar(ch)) return;
      checksum += ch;
      count += 1;
    }
--- 527,533 ----
    count    = 0;
  
    while (ch=buffer[count]) {
!     putDebugChar(ch);
      checksum += ch;
      count += 1;
    }
Index: m32r-stub.c
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/m32r-stub.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 m32r-stub.c
*** m32r-stub.c	1998/12/03 00:05:16	1.1.1.1
--- m32r-stub.c	1998/12/03 19:26:17
***************
*** 94,101 ****
   *
   * external low-level support routines
   */
! extern putDebugChar();		/* write a single character      */
! extern getDebugChar();		/* read and return a single char */
  extern void exceptionHandler();	/* assign an exception handler   */
  
  /*****************************************************************************
--- 94,101 ----
   *
   * external low-level support routines
   */
! extern void putDebugChar();	/* write a single character      */
! extern int getDebugChar();	/* read and return a single char */
  extern void exceptionHandler();	/* assign an exception handler   */
  
  /*****************************************************************************
***************
*** 581,587 ****
      count    = 0;
  
      while (ch=buffer[count]) {
!       if (! putDebugChar(ch)) return;
        checksum += ch;
        count += 1;
      }
--- 581,587 ----
      count    = 0;
  
      while (ch=buffer[count]) {
!       putDebugChar(ch);
        checksum += ch;
        count += 1;
      }
Index: m68k-stub.c
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/m68k-stub.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 m68k-stub.c
*** m68k-stub.c	1998/12/03 00:05:16	1.1.1.1
--- m68k-stub.c	1998/12/03 19:26:39
***************
*** 116,123 ****
  typedef void (*ExceptionHook)(int);   /* pointer to function with int parm */
  typedef void (*Function)();           /* pointer to a function */
  
! extern putDebugChar();   /* write a single character      */
! extern getDebugChar();   /* read and return a single char */
  
  extern Function exceptionHandler();  /* assign an exception handler */
  extern ExceptionHook exceptionHook;  /* hook variable for errors/exceptions */
--- 116,123 ----
  typedef void (*ExceptionHook)(int);   /* pointer to function with int parm */
  typedef void (*Function)();           /* pointer to a function */
  
! extern void putDebugChar();	/* write a single character      */
! extern int getDebugChar();	/* read and return a single char */
  
  extern Function exceptionHandler();  /* assign an exception handler */
  extern ExceptionHook exceptionHook;  /* hook variable for errors/exceptions */
***************
*** 594,600 ****
    count    = 0;
    
    while (ch=buffer[count]) {
!     if (! putDebugChar(ch)) return;
      checksum += ch;
      count += 1;
    }
--- 594,600 ----
    count    = 0;
    
    while (ch=buffer[count]) {
!     putDebugChar(ch);
      checksum += ch;
      count += 1;
    }
Index: sh-stub.c
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/sh-stub.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 sh-stub.c
*** sh-stub.c	1998/12/03 00:05:22	1.1.1.1
--- sh-stub.c	1998/12/03 19:29:02
***************
*** 202,209 ****
  static void handle_exception (int exceptionVector);
  void init_serial();
  
! 
! int putDebugChar (char);
  char getDebugChar (void);
  
  /* These are in the file but in asm statements so the compiler can't see them */
--- 202,208 ----
  static void handle_exception (int exceptionVector);
  void init_serial();
  
! void putDebugChar (char);
  char getDebugChar (void);
  
  /* These are in the file but in asm statements so the compiler can't see them */
***************
*** 1457,1464 ****
  #define BPS			32	/* 9600 for 10 Mhz */
  #endif
  
- char getDebugChar (void);
- int putDebugChar (char);
  void handleError (char theSSR);
  
  void
--- 1456,1461 ----
***************
*** 1531,1537 ****
    return (SSR1 & SCI_TDRE);
  }
  
! int 
  putDebugChar (char ch)
  {
    while (!putDebugCharReady())
--- 1528,1534 ----
    return (SSR1 & SCI_TDRE);
  }
  
! void
  putDebugChar (char ch)
  {
    while (!putDebugCharReady())
***************
*** 1542,1548 ****
     */
    TDR1 = ch;
    SSR1 &= ~SCI_TDRE;
-   return 1;
  }
  
  void 
--- 1539,1544 ----
Index: sparc-stub.c
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/sparc-stub.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 sparc-stub.c
*** sparc-stub.c	1998/12/03 00:05:23	1.1.1.1
--- sparc-stub.c	1998/12/03 19:30:15
***************
*** 92,99 ****
   * external low-level support routines
   */
  
! extern putDebugChar();   /* write a single character      */
! extern getDebugChar();   /* read and return a single char */
  
  /************************************************************************/
  /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
--- 92,99 ----
   * external low-level support routines
   */
  
! extern void putDebugChar();	/* write a single character      */
! extern int getDebugChar();	/* read and return a single char */
  
  /************************************************************************/
  /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
***************
*** 371,378 ****
  
        while (ch = buffer[count])
  	{
! 	  if (! putDebugChar(ch))
! 	    return;
  	  checksum += ch;
  	  count += 1;
  	}
--- 371,377 ----
  
        while (ch = buffer[count])
  	{
! 	  putDebugChar(ch);
  	  checksum += ch;
  	  count += 1;
  	}
Index: sparclet-stub.c
===================================================================
RCS file: /usr/rback/release/tools-src/gdb/gdb/sparclet-stub.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 sparclet-stub.c
*** sparclet-stub.c	1998/12/03 00:05:21	1.1.1.1
--- sparclet-stub.c	1998/12/03 19:32:08
***************
*** 95,102 ****
   * external low-level support routines
   */
  
! extern putDebugChar();   /* write a single character      */
! extern getDebugChar();   /* read and return a single char */
  
  /************************************************************************/
  /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
--- 95,102 ----
   * external low-level support routines
   */
  
! extern void putDebugChar();	/* write a single character      */
! extern int getDebugChar();	/* read and return a single char */
  
  /************************************************************************/
  /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
***************
*** 534,541 ****
  
        while (ch = buffer[count])
  	{
! 	  if (! putDebugChar(ch))
! 	    return;
  	  checksum += ch;
  	  count += 1;
  	}
--- 534,540 ----
  
        while (ch = buffer[count])
  	{
! 	  putDebugChar(ch);
  	  checksum += ch;
  	  count += 1;
  	}


             reply	other threads:[~1998-12-03 11:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-03 11:53 J.T. Conklin [this message]
     [not found] <199812031953.LAA12865.cygnus.patches.gdb@jtc.redbacknetworks.com>
1999-04-01  0:00 ` Stan Shebs
1999-01-31 13:48   ` Stan Shebs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199812031953.LAA12865@jtc.redbacknetworks.com \
    --to=jtc@redbacknetworks.com \
    --cc=gdb-patches@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox