Changeset 22fa5832 in rtems


Ignore:
Timestamp:
Oct 28, 1998, 7:41:06 PM (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
2119f9d
Parents:
b4e3b2b
Message:

Patch from Ian Lance Taylor <ian@…>:

The RTEMS i386 stub in

c/src/lib/libbsp/i386/shared/comm/i386-stub.c

doesn't take advantage of some of the newer gdb remote features which
permits shorter and fewer packets.

Here is a patch which uses the 'T' response to report the registers
which gdb generally needs, and implements the 'P' request to set only
a single register. The general effect is to avoid sending all the
register contents back and forth between gdb and the stub every time
the stub stops. This also implements the 'D' request which handles
the gdb detach command, so you can cleanly quit out of the debugger
and leave the target board running.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/shared/comm/i386-stub.c

    rb4e3b2b r22fa5832  
    125125static const char hexchars[] = "0123456789abcdef";
    126126
     127/* Number of registers.  */
     128#define NUMREGS 16
     129
     130/* Number of bytes per register.  */
     131#define REGBYTES 4
     132
    127133/* Number of bytes of registers.  */
    128 #define NUMREGBYTES 64
     134#define NUMREGBYTES (NUMREGS * REGBYTES)
     135
    129136enum regnames
    130137  {
     
    138145 * these should not be static cuz they can be used outside this module
    139146 */
    140 int registers[NUMREGBYTES / 4];
     147int registers[NUMREGS];
    141148
    142149#define STACKSIZE 10000
     
    742749{
    743750  int sigval;
    744   int addr, length;
     751  int addr, length, reg;
    745752  char *ptr;
    746753  int newPC;
     
    754761            registers[PC]);
    755762
    756   /* reply to host that an exception has occurred */
     763  /* Reply to host that an exception has occurred.  Always return the
     764     PC, SP, and FP, since gdb always wants them.  */
     765  ptr = remcomOutBuffer;
     766  *ptr++ = 'T';
    757767  sigval = computeSignal (exceptionVector);
    758   remcomOutBuffer[0] = 'S';
    759   remcomOutBuffer[1] = hexchars[sigval >> 4];
    760   remcomOutBuffer[2] = hexchars[sigval % 16];
    761   remcomOutBuffer[3] = 0;
     768  *ptr++ = hexchars[sigval >> 4];
     769  *ptr++ = hexchars[sigval % 16];
     770
     771  *ptr++ = hexchars[ESP];
     772  *ptr++ = ':';
     773  mem2hex ((char *) &registers[ESP], ptr, REGBYTES, 0);
     774  ptr += REGBYTES * 2;
     775  *ptr++ = ';';
     776
     777  *ptr++ = hexchars[EBP];
     778  *ptr++ = ':';
     779  mem2hex ((char *) &registers[EBP], ptr, REGBYTES, 0);
     780  ptr += REGBYTES * 2;
     781  *ptr++ = ';';
     782
     783  *ptr++ = hexchars[PC];
     784  *ptr++ = ':';
     785  mem2hex ((char *) &registers[PC], ptr, REGBYTES, 0);
     786  ptr += REGBYTES * 2;
     787  *ptr++ = ';';
     788
     789  *ptr = '\0';
    762790
    763791  putpacket (remcomOutBuffer);
     
    787815          break;
    788816
     817        case 'P':               /* Set specific register */
     818          ptr = &remcomInBuffer[1];
     819          if (hexToInt (&ptr, &reg)
     820              && *ptr++ == '=')
     821            {
     822              hex2mem (ptr, (char *) &registers[reg], REGBYTES, 0);
     823              strcpy (remcomOutBuffer, "OK");
     824            }
     825          else
     826            {
     827              strcpy (remcomOutBuffer, "E01");
     828              debug_error ("malformed register set command; %s",
     829                           remcomInBuffer);
     830            }
     831          break;
     832
    789833          /* mAA..AA,LLLL  Read LLLL bytes at address AA..AA */
    790834        case 'm':
     
    865909          break;
    866910
     911          /* Detach.  */
     912        case 'D':
     913          putpacket (remcomOutBuffer);
     914          registers[PS] &= 0xfffffeff;
     915          _returnFromException ();      /* this is a jump */
     916
     917          break;
     918
    867919          /* kill the program */
    868920        case 'k':               /* do nothing */
Note: See TracChangeset for help on using the changeset viewer.