X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fi386-stub.c;h=04996b75cf68073a9bdc3baba92ad96419d567fd;hb=1777feb0fea5ec350a86eecf81f71ccc60d4cf6f;hp=7aa5da9369c1337fb30fa30b4c3bd87f16b4f2aa;hpb=f29d9b6d302bcf6ec42feb3a3bdbabe534177258;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/i386-stub.c b/gdb/i386-stub.c index 7aa5da9369..04996b75cf 100644 --- a/gdb/i386-stub.c +++ b/gdb/i386-stub.c @@ -474,7 +474,7 @@ getpacket (void) count = 0; /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) + while (count < BUFMAX - 1) { ch = getDebugChar (); if (ch == '$') @@ -532,7 +532,7 @@ putpacket (unsigned char *buffer) int count; char ch; - /* $#. */ + /* $#. */ do { putDebugChar ('$'); @@ -758,10 +758,29 @@ handle_exception (int exceptionVector) /* reply to host that an exception has occurred */ sigval = computeSignal (exceptionVector); - remcomOutBuffer[0] = 'S'; - remcomOutBuffer[1] = hexchars[sigval >> 4]; - remcomOutBuffer[2] = hexchars[sigval % 16]; - remcomOutBuffer[3] = 0; + + ptr = remcomOutBuffer; + + *ptr++ = 'T'; /* notify gdb with signo, PC, FP and SP */ + *ptr++ = hexchars[sigval >> 4]; + *ptr++ = hexchars[sigval & 0xf]; + + *ptr++ = hexchars[ESP]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[ESP], ptr, 4, 0); /* SP */ + *ptr++ = ';'; + + *ptr++ = hexchars[EBP]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[EBP], ptr, 4, 0); /* FP */ + *ptr++ = ';'; + + *ptr++ = hexchars[PC]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); /* PC */ + *ptr++ = ';'; + + *ptr = '\0' putpacket (remcomOutBuffer); @@ -923,7 +942,7 @@ set_debug_traps (void) /* This function will generate a breakpoint exception. It is used at the beginning of a program to sync up with a debugger and can be used otherwise as a quick means to stop program execution and "break" into - the debugger. */ + the debugger. */ void breakpoint (void)