This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
yet another stub patch: further getpacket() refinement
- To: gdb-patches@sourceware.cygnus.com
- Subject: yet another stub patch: further getpacket() refinement
- From: jtc@redback.com (J.T. Conklin)
- Date: 31 Aug 1999 11:54:31 -0700
- Reply-To: jtc@redback.com
The enclosed patch changes getpacket() such that the implementation of
the input buffer is hidden from handle_exception(). This gives users
the freedom to change getpacket() however necessary without effecting
the rest of the stub.
Of course, handle_exception() should also be isolated from putpacket(),
but that's another patch.
--jtc
1999-08-31 J.T. Conklin <jtc@redback.com>
* i386-stub.c, m32r-stub.c, m68k-stub.c, sh-stub.c, sparc-stub.c,
sparcl-stub.c, sparclet-stub.c (getpacket): Removed 'buffer' arg,
define it as a pointer to &remcomInBuffer[0].
(handle_exception): Update.
Index: i386-stub.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/i386-stub.c,v
retrieving revision 1.5
diff -c -r1.5 i386-stub.c
*** i386-stub.c 1999/08/18 06:25:40 1.5
--- i386-stub.c 1999/08/31 16:29:00
***************
*** 459,467 ****
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket (buffer)
! unsigned char *buffer;
{
unsigned char checksum;
unsigned char xmitcsum;
int count;
--- 459,467 ----
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket ()
{
+ unsigned char *buffer = &remcomInBuffer[0];
unsigned char checksum;
unsigned char xmitcsum;
int count;
***************
*** 741,747 ****
while (1==1) {
error = 0;
remcomOutBuffer[0] = 0;
! ptr = getpacket(remcomInBuffer);
switch (*ptr++) {
case '?' : remcomOutBuffer[0] = 'S';
--- 741,747 ----
while (1==1) {
error = 0;
remcomOutBuffer[0] = 0;
! ptr = getpacket();
switch (*ptr++) {
case '?' : remcomOutBuffer[0] = 'S';
Index: m32r-stub.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/m32r-stub.c,v
retrieving revision 1.4
diff -c -r1.4 m32r-stub.c
*** m32r-stub.c 1999/08/18 06:25:41 1.4
--- m32r-stub.c 1999/08/31 16:29:52
***************
*** 179,185 ****
static int computeSignal(int);
static void putpacket(unsigned char *);
! static unsigned char *getpacket(unsigned char *);
static unsigned char *mem2hex(unsigned char *, unsigned char *, int, int);
static unsigned char *hex2mem(unsigned char *, unsigned char *, int, int);
--- 179,185 ----
static int computeSignal(int);
static void putpacket(unsigned char *);
! static unsigned char *getpacket(void);
static unsigned char *mem2hex(unsigned char *, unsigned char *, int, int);
static unsigned char *hex2mem(unsigned char *, unsigned char *, int, int);
***************
*** 310,316 ****
while (1==1) {
remcomOutBuffer[0] = 0;
! ptr = getpacket(remcomInBuffer);
binary = 0;
switch (*ptr++) {
default: /* Unknown code. Return an empty reply message. */
--- 310,316 ----
while (1==1) {
remcomOutBuffer[0] = 0;
! ptr = getpacket();
binary = 0;
switch (*ptr++) {
default: /* Unknown code. Return an empty reply message. */
***************
*** 575,583 ****
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket (buffer)
! unsigned char *buffer;
{
unsigned char checksum;
unsigned char xmitcsum;
int count;
--- 575,583 ----
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket ()
{
+ unsigned char *buffer = &remcomInBuffer[0];
unsigned char checksum;
unsigned char xmitcsum;
int count;
Index: m68k-stub.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/m68k-stub.c,v
retrieving revision 1.5
diff -c -r1.5 m68k-stub.c
*** m68k-stub.c 1999/08/31 16:13:06 1.5
--- m68k-stub.c 1999/08/31 16:30:20
***************
*** 525,532 ****
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket (unsigned char *buffer)
{
unsigned char checksum;
unsigned char xmitcsum;
int count;
--- 525,533 ----
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket ()
{
+ unsigned char *buffer = &remcomInBuffer[0];
unsigned char checksum;
unsigned char xmitcsum;
int count;
***************
*** 779,785 ****
while (1==1) {
error = 0;
remcomOutBuffer[0] = 0;
! ptr = getpacket(remcomInBuffer);
switch (*ptr++) {
case '?' : remcomOutBuffer[0] = 'S';
remcomOutBuffer[1] = hexchars[sigval >> 4];
--- 780,786 ----
while (1==1) {
error = 0;
remcomOutBuffer[0] = 0;
! ptr = getpacket();
switch (*ptr++) {
case '?' : remcomOutBuffer[0] = 'S';
remcomOutBuffer[1] = hexchars[sigval >> 4];
Index: sh-stub.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/sh-stub.c,v
retrieving revision 1.6
diff -c -r1.6 sh-stub.c
*** sh-stub.c 1999/08/31 16:13:10 1.6
--- sh-stub.c 1999/08/31 16:31:08
***************
*** 199,205 ****
static char *mem2hex (char *, char *, int);
static char *hex2mem (char *, char *, int);
static int hexToInt (char **, int *);
! static unsigned char *getpacket (unsigned char *);
static void putpacket (char *);
static void handle_buserror (void);
static int computeSignal (int exceptionVector);
--- 199,205 ----
static char *mem2hex (char *, char *, int);
static char *hex2mem (char *, char *, int);
static int hexToInt (char **, int *);
! static unsigned char *getpacket (void);
static void putpacket (char *);
static void handle_buserror (void);
static int computeSignal (int exceptionVector);
***************
*** 383,391 ****
/* scan for the sequence $<data>#<checksum> */
char *
! getpacket (buffer)
! char *buffer;
{
unsigned char checksum;
unsigned char xmitcsum;
int count;
--- 383,391 ----
/* scan for the sequence $<data>#<checksum> */
char *
! getpacket ()
{
+ unsigned char *buffer = &remcomInBuffer[0];
unsigned char checksum;
unsigned char xmitcsum;
int count;
***************
*** 689,695 ****
while (1)
{
remcomOutBuffer[0] = 0;
! ptr = getpacket (remcomInBuffer);
switch (*ptr++)
{
--- 689,695 ----
while (1)
{
remcomOutBuffer[0] = 0;
! ptr = getpacket ();
switch (*ptr++)
{
Index: sparc-stub.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/sparc-stub.c,v
retrieving revision 1.5
diff -c -r1.5 sparc-stub.c
*** sparc-stub.c 1999/08/30 17:46:13 1.5
--- sparc-stub.c 1999/08/31 16:31:53
***************
*** 284,292 ****
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket (buffer)
! unsigned char *buffer;
{
unsigned char checksum;
unsigned char xmitcsum;
int count;
--- 284,292 ----
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket ()
{
+ unsigned char *buffer = &remcomInBuffer[0];
unsigned char checksum;
unsigned char xmitcsum;
int count;
***************
*** 650,656 ****
{
remcomOutBuffer[0] = 0;
! ptr = getpacket(remcomInBuffer);
switch (*ptr++)
{
case '?':
--- 650,656 ----
{
remcomOutBuffer[0] = 0;
! ptr = getpacket();
switch (*ptr++)
{
case '?':
Index: sparcl-stub.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/sparcl-stub.c,v
retrieving revision 1.5
diff -c -r1.5 sparcl-stub.c
*** sparcl-stub.c 1999/08/30 17:46:13 1.5
--- sparcl-stub.c 1999/08/31 16:32:33
***************
*** 380,388 ****
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket (buffer)
! unsigned char *buffer;
{
unsigned char checksum;
unsigned char xmitcsum;
int count;
--- 380,388 ----
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket ()
{
+ unsigned char *buffer = &remcomInBuffer[0];
unsigned char checksum;
unsigned char xmitcsum;
int count;
***************
*** 793,799 ****
{
remcomOutBuffer[0] = 0;
! ptr = getpacket(remcomInBuffer);
switch (*ptr++)
{
case '?':
--- 793,799 ----
{
remcomOutBuffer[0] = 0;
! ptr = getpacket();
switch (*ptr++)
{
case '?':
Index: sparclet-stub.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/sparclet-stub.c,v
retrieving revision 1.5
diff -c -r1.5 sparclet-stub.c
*** sparclet-stub.c 1999/08/30 17:46:14 1.5
--- sparclet-stub.c 1999/08/31 16:33:03
***************
*** 450,458 ****
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket (buffer)
! unsigned char *buffer;
{
unsigned char checksum;
unsigned char xmitcsum;
int count;
--- 450,458 ----
/* scan for the sequence $<data>#<checksum> */
unsigned char *
! getpacket ()
{
+ unsigned char *buffer = &remcomInBuffer[0];
unsigned char checksum;
unsigned char xmitcsum;
int count;
***************
*** 878,884 ****
{
remcomOutBuffer[0] = 0;
! ptr = getpacket(remcomInBuffer);
switch (*ptr++)
{
case '?':
--- 878,884 ----
{
remcomOutBuffer[0] = 0;
! ptr = getpacket();
switch (*ptr++)
{
case '?':
--
J.T. Conklin
RedBack Networks