Defines | Enumerations | Functions | Variables

i386-stub-win32.c File Reference

#include <stdio.h>
#include <string.h>
#include "utility/utility.h"
Include dependency graph for i386-stub-win32.c:

Go to the source code of this file.

Defines

#define BUFMAX   400
#define NUMREGS   16
#define NUMREGBYTES   (NUMREGS * 4)
#define STACKSIZE   10000
#define SAVE_REGISTERS1()
#define SAVE_ERRCODE()
#define SAVE_REGISTERS2()
#define CHECK_FAULT()
#define CALL_HOOK()   asm("call _remcomHandler");
#define BREAKPOINT()   asm(" int $3");

Enumerations

enum  regnames {
  EAX, ECX, EDX, EBX,
  ESP, EBP, ESI, EDI,
  PC, PS, CS, SS,
  DS, ES, FS, GS
}

Functions

void putDebugChar ()
int getDebugChar ()
void exceptionHandler ()
void return_to_prog ()
 asm (".text")
 asm (".globl _return_to_prog")
 asm ("_return_to_prog:")
 asm (" movw _registers+44, %ss")
 asm (" movl _registers+16, %esp")
 asm (" movl _registers+4, %ecx")
 asm (" movl _registers+8, %edx")
 asm (" movl _registers+12, %ebx")
 asm (" movl _registers+20, %ebp")
 asm (" movl _registers+24, %esi")
 asm (" movl _registers+28, %edi")
 asm (" movw _registers+48, %ds")
 asm (" movw _registers+52, %es")
 asm (" movw _registers+56, %fs")
 asm (" movw _registers+60, %gs")
 asm (" movl _registers+36, %eax")
 asm (" pushl %eax")
 asm (" movl _registers, %eax")
 asm ("ret")
 asm (" iret")
 asm ("mem_fault:")
 asm (" popl %eax")
 asm (" movl %eax, _gdb_i386errcode")
 asm (" popl %ecx")
 asm (" popl %edx")
 asm (" leave")
 asm (" pushl %edx")
 asm (" pushl %ecx")
 asm (" movl $0, %eax")
 asm (" movl %eax, _mem_fault_routine")
 asm ("iret")
void _catchException3 ()
 asm (".globl __catchException3")
 asm ("__catchException3:")
 asm ("pushl $3")
void _catchException1 ()
 asm (".globl __catchException1")
 asm ("__catchException1:")
 asm ("pushl $1")
void _catchException0 ()
 asm (".globl __catchException0")
 asm ("__catchException0:")
 asm ("pushl $0")
void _catchException4 ()
 asm (".globl __catchException4")
 asm ("__catchException4:")
 asm ("pushl $4")
void _catchException5 ()
 asm (".globl __catchException5")
 asm ("__catchException5:")
 asm ("pushl $5")
void _catchException6 ()
 asm (".globl __catchException6")
 asm ("__catchException6:")
 asm ("pushl $6")
void _catchException7 ()
 asm (".globl __catchException7")
 asm ("__catchException7:")
 asm ("pushl $7")
void _catchException8 ()
 asm (".globl __catchException8")
 asm ("__catchException8:")
 asm ("pushl $8")
void _catchException9 ()
 asm (".globl __catchException9")
 asm ("__catchException9:")
 asm ("pushl $9")
void _catchException10 ()
 asm (".globl __catchException10")
 asm ("__catchException10:")
 asm ("pushl $10")
void _catchException12 ()
 asm (".globl __catchException12")
 asm ("__catchException12:")
 asm ("pushl $12")
void _catchException16 ()
 asm (".globl __catchException16")
 asm ("__catchException16:")
 asm ("pushl $16")
void _catchException13 ()
 asm (".globl __catchException13")
 asm ("__catchException13:")
 asm ("pushl $13")
void _catchException11 ()
 asm (".globl __catchException11")
 asm ("__catchException11:")
 asm ("pushl $11")
void _catchException14 ()
 asm (".globl __catchException14")
 asm ("__catchException14:")
 asm ("pushl $14")
 asm ("_remcomHandler:")
 asm (" movl _stackPtr, %esp")
 asm (" call _handle_exception")
void _returnFromException ()
int hex (char ch)
char * getpacket (void)
void putpacket (char *buffer)
void debug_error (char *format)
void set_mem_err (void)
int get_char (char *addr)
void set_char (char *addr, int val)
char * mem2hex (char *mem, char *buf, int count, int may_fault)
char * hex2mem (char *buf, char *mem, int count, int may_fault)
int computeSignal (int exceptionVector)
int hexToInt (char **ptr, int *intValue)
void handle_exception (int exceptionVector)
void set_debug_traps (void)
void breakpoint (void)

Variables

int remote_debug
int registers [NUMREGS]
int remcomStack [STACKSIZE/sizeof(int)]
int gdb_i386errcode
int gdb_i386vector = -1

Define Documentation

#define BREAKPOINT (  )    asm(" int $3");

Definition at line 456 of file i386-stub-win32.c.

Referenced by breakpoint(), and handle_exception().

#define BUFMAX   400

Definition at line 109 of file i386-stub-win32.c.

Referenced by getpacket(), and handle_exception().

CALL_HOOK (  )    asm("call _remcomHandler");

Definition at line 260 of file i386-stub-win32.c.

CHECK_FAULT (  )
Value:
asm ("cmpl $0, _mem_fault_routine");                                       \
  asm ("jne mem_fault");

Definition at line 225 of file i386-stub-win32.c.

#define NUMREGBYTES   (NUMREGS * 4)

Definition at line 122 of file i386-stub-win32.c.

Referenced by handle_exception().

#define NUMREGS   16

Definition at line 119 of file i386-stub-win32.c.

Referenced by handle_exception().

SAVE_ERRCODE (  )
Value:
asm ("popl %ebx");                                \
  asm ("movl %ebx, _gdb_i386errcode");

Definition at line 208 of file i386-stub-win32.c.

SAVE_REGISTERS1 (  )
Value:
asm ("movl %eax, _registers");                                        \
  asm ("movl %ecx, _registers+4");                                           \
  asm ("movl %edx, _registers+8");                                           \
  asm ("movl %ebx, _registers+12");                                          \
  asm ("movl %ebp, _registers+20");                                          \
  asm ("movl %esi, _registers+24");                                          \
  asm ("movl %edi, _registers+28");                                          \
  asm ("movw $0, %ax");                                                      \
  asm ("movw %ds, _registers+48");                                           \
  asm ("movw %ax, _registers+50");                                           \
  asm ("movw %es, _registers+52");                                           \
  asm ("movw %ax, _registers+54");                                           \
  asm ("movw %fs, _registers+56");                                           \
  asm ("movw %ax, _registers+58");                                           \
  asm ("movw %gs, _registers+60");                                           \
  asm ("movw %ax, _registers+62");

Definition at line 191 of file i386-stub-win32.c.

SAVE_REGISTERS2 (  )
Value:
asm ("popl %ebx"); /* old eip */                                             \
  asm ("movl %ebx, _registers+32");                                          \
  asm ("popl %ebx");     /* old cs */                                        \
  asm ("movl %ebx, _registers+40");                                          \
  asm ("movw %ax, _registers+42");                                           \
  asm ("popl %ebx");     /* old eflags */                                    \
  asm ("movl %ebx, _registers+36");                                          \
  /* Now that we've done the pops, we can save the stack pointer.");  */   \
  asm ("movw %ss, _registers+44");                                           \
  asm ("movw %ax, _registers+46");                                           \
  asm ("movl %esp, _registers+16");

Definition at line 211 of file i386-stub-win32.c.

#define STACKSIZE   10000

Definition at line 136 of file i386-stub-win32.c.

Referenced by set_debug_traps().


Enumeration Type Documentation

enum regnames
Enumerator:
EAX 
ECX 
EDX 
EBX 
ESP 
EBP 
ESI 
EDI 
PC 
PS 
CS 
SS 
DS 
ES 
FS 
GS 

Definition at line 124 of file i386-stub-win32.c.

              {EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI,
               PC /* also known as eip */,
               PS /* also known as eflags */,
               CS, SS, DS, ES, FS, GS};

Function Documentation

void _catchException0 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException1 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException10 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException11 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException12 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException13 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException14 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException16 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException3 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException4 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException5 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException6 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException7 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException8 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _catchException9 (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

void _returnFromException (  )

Definition at line 445 of file i386-stub-win32.c.

References return_to_prog().

Referenced by handle_exception().

Here is the call graph for this function:

Here is the caller graph for this function:

asm ( " call _handle_exception"   )
asm ( " movw _registers+  48,
%ds"   
)
asm ( " pushl %ecx"   )
asm ( "pushl $14"   )
asm ( "__catchException14:"   )
asm ( ".globl __catchException14"   )
asm ( ".globl __catchException8"   )
asm ( "pushl $11"   )
asm ( "__catchException11:"   )
asm ( ".globl __catchException11"   )
asm ( " movl $  0,
%eax"   
)
asm ( "pushl $13"   )
asm ( "__catchException13:"   )
asm ( ".globl __catchException13"   )
asm ( "__catchException8:"   )
asm ( "pushl $16"   )
asm ( "__catchException16:"   )
asm ( "pushl $8"   )
asm ( " movw _registers+  44,
%ss"   
)
asm ( "pushl $12"   )
asm ( "__catchException12:"   )
asm ( ".globl __catchException12"   )
asm ( " movw _registers+  52,
%es"   
)
asm ( "pushl $10"   )
asm ( "__catchException10:"   )
asm ( " movl %  eax,
_mem_fault_routine"   
)
asm ( ".globl __catchException9"   )
asm ( "iret"   )
asm ( "__catchException9:"   )
asm ( "pushl $9"   )
asm ( " movl _registers+  16,
%esp"   
)
asm ( " movw _registers+  56,
%fs"   
)
asm ( ".globl __catchException10"   )
asm ( ".globl __catchException3"   )
asm ( " movw _registers+  60,
%gs"   
)
asm ( "pushl $7"   )
asm ( "__catchException7:"   )
asm ( ".globl __catchException7"   )
asm ( "__catchException3:"   )
asm ( "pushl $6"   )
asm ( "__catchException6:"   )
asm ( ".globl __catchException6"   )
asm ( "pushl $3"   )
asm ( "pushl $5"   )
asm ( "__catchException5:"   )
asm ( ".globl __catchException5"   )
asm ( " popl %eax"   )
asm ( "pushl $4"   )
asm ( "__catchException4:"   )
asm ( " iret"   )
asm ( " movl _registers+  4,
%ecx"   
)
asm ( "pushl $0"   )
asm ( "__catchException0:"   )
asm ( ".globl __catchException0"   )
asm ( " movl   _registers,
%eax"   
)
asm ( "pushl $1"   )
asm ( "__catchException1:"   )
asm ( " movl _registers+  36,
%eax"   
)
asm ( ".globl __catchException16"   )
asm ( ".globl __catchException1"   )
asm ( " pushl %eax"   )
asm ( ".text"   )
asm ( " movl _registers+  8,
%edx"   
)
asm ( "ret"   )
asm ( ".globl __catchException4"   )
asm ( " movl _registers+  12,
%ebx"   
)
asm ( "_remcomHandler:"   )
asm ( " pushl %edx"   )
asm ( " leave"   )
asm ( " popl %edx"   )
asm ( " popl %ecx"   )
asm ( " movl %  eax,
_gdb_i386errcode"   
)
asm ( " movl _registers+  20,
%ebp"   
)
asm ( " movl   _stackPtr,
%esp"   
)
asm ( "mem_fault:"   )
asm ( ".globl _return_to_prog"   )
asm ( "_return_to_prog:"   )
asm ( " movl _registers+  24,
%esi"   
)
asm ( " movl _registers+  28,
%edi"   
)
void breakpoint ( void   )

Definition at line 1046 of file i386-stub-win32.c.

References BREAKPOINT.

{
  if (initialized)
    BREAKPOINT ();
}
int computeSignal ( int  exceptionVector )

Definition at line 745 of file i386-stub-win32.c.

Referenced by handle_exception().

{
  int sigval;
  switch (exceptionVector)
    {
    case 0:
      sigval = 8;
      break;                    /* divide by zero */
    case 1:
      sigval = 5;
      break;                    /* debug exception */
    case 3:
      sigval = 5;
      break;                    /* breakpoint */
    case 4:
      sigval = 16;
      break;                    /* into instruction (overflow) */
    case 5:
      sigval = 16;
      break;                    /* bound instruction */
    case 6:
      sigval = 4;
      break;                    /* Invalid opcode */
    case 7:
      sigval = 8;
      break;                    /* coprocessor not available */
    case 8:
      sigval = 7;
      break;                    /* double fault */
    case 9:
      sigval = 11;
      break;                    /* coprocessor segment overrun */
    case 10:
      sigval = 11;
      break;                    /* Invalid TSS */
    case 11:
      sigval = 11;
      break;                    /* Segment not present */
    case 12:
      sigval = 11;
      break;                    /* stack exception */
    case 13:
      sigval = 11;
      break;                    /* general protection */
    case 14:
      sigval = 11;
      break;                    /* page fault */
    case 16:
      sigval = 7;
      break;                    /* coprocessor error */
    default:
      sigval = 7;               /* "software generated" */
    }
  return (sigval);
}

Here is the caller graph for this function:

void debug_error ( char *  format )

Definition at line 630 of file i386-stub-win32.c.

References remote_debug.

Referenced by handle_exception().

{
  if (remote_debug)
    fprintf (stderr, format/*, parm*/);
}

Here is the caller graph for this function:

void exceptionHandler (  )

Referenced by set_debug_traps().

Here is the caller graph for this function:

int get_char ( char *  addr )

Definition at line 654 of file i386-stub-win32.c.

Referenced by mem2hex().

{
  return *addr;
}

Here is the caller graph for this function:

int getDebugChar (  )

Referenced by getpacket(), and putpacket().

Here is the caller graph for this function:

char* getpacket ( void   )

Definition at line 530 of file i386-stub-win32.c.

References BUFMAX, getDebugChar(), hex(), putDebugChar(), and remote_debug.

Referenced by handle_exception().

{
  char *buffer = &remcomInBuffer[0];
  unsigned char checksum;
  unsigned char xmitcsum;
  int count;
  char ch;

  while (1)
    {
      /* wait around for the start character, ignore all other characters */
      while ((ch = getDebugChar ()) != '$')
        ;

    retry:
      checksum = 0;
      xmitcsum = -1;
      count = 0;

      /* now, read until a # or end of buffer is found */
      while (count < BUFMAX)
        {
          ch = getDebugChar ();
          if (ch == '$')
            goto retry;
          if (ch == '#')
            break;
          checksum = checksum + ch;
          buffer[count] = ch;
          count = count + 1;
        }
      buffer[count] = 0;

      if (ch == '#')
        {
          ch = getDebugChar ();
          xmitcsum = hex (ch) << 4;
          ch = getDebugChar ();
          xmitcsum += hex (ch);

          if (checksum != xmitcsum)
            {
              if (remote_debug)
                {
                  fprintf (stderr,
                           "bad checksum.  My count = 0x%x, sent=0x%x. buf=%s\n",
                           checksum, xmitcsum, buffer);
                }
              putDebugChar ('-');       /* failed checksum */
            }
          else
            {
              putDebugChar ('+');       /* successful transfer */

              /* if a sequence char is present, reply the sequence ID */
              if (buffer[2] == ':')
                {
                  putDebugChar (buffer[0]);
                  putDebugChar (buffer[1]);

                  return &buffer[3];
                }

              return &buffer[0];
            }
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void handle_exception ( int  exceptionVector )

Definition at line 834 of file i386-stub-win32.c.

References _returnFromException(), BREAKPOINT, BUFMAX, computeSignal(), debug_error(), EBP, ESP, gdb_i386vector, getpacket(), hex2mem(), hexToInt(), mem2hex(), NUMREGBYTES, NUMREGS, PC, PS, putpacket(), registers, remote_debug, and strcpy_s.

{
  int sigval, stepping;
  int addr, length;
  char *ptr;
  int newPC;

#ifndef WIN32 //MF
  gdb_i386vector = exceptionVector;
#endif

  if (remote_debug)
    {
      printf ("vector=%d, sr=0x%x, pc=0x%x\n",
              exceptionVector, registers[PS], registers[PC]);
    }

  /* reply to host that an exception has occurred */
  sigval = computeSignal (exceptionVector);

  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 *)&registers[ESP], ptr, 4, 0);    /* SP */
  *ptr++ = ';';

  *ptr++ = hexchars[EBP];
  *ptr++ = ':';
  ptr = mem2hex((char *)&registers[EBP], ptr, 4, 0);    /* FP */
  *ptr++ = ';';

  *ptr++ = hexchars[PC];
  *ptr++ = ':';
  ptr = mem2hex((char *)&registers[PC], ptr, 4, 0);     /* PC */
  *ptr++ = ';';

  *ptr = '\0';

  putpacket (remcomOutBuffer);

  stepping = 0;

  while (1 == 1)
    {
      remcomOutBuffer[0] = 0;
      ptr = getpacket ();

      switch (*ptr++)
        {
        case '?':
          remcomOutBuffer[0] = 'S';
          remcomOutBuffer[1] = hexchars[sigval >> 4];
          remcomOutBuffer[2] = hexchars[sigval % 16];
          remcomOutBuffer[3] = 0;
          break;
        case 'd':
          remote_debug = !(remote_debug);       /* toggle debug flag */
          break;
        case 'g':               /* return the value of the CPU registers */
          mem2hex ((char *) registers, remcomOutBuffer, NUMREGBYTES, 0);
          break;
        case 'G':               /* set the value of the CPU registers - return OK */
          hex2mem (ptr, (char *) registers, NUMREGBYTES, 0);
          strcpy_s(remcomOutBuffer, BUFMAX, "OK");
          break;
        case 'P':               /* set the value of a single CPU register - return OK */
          {
            int regno;

            if (hexToInt (&ptr, &regno) && *ptr++ == '=')
              if (regno >= 0 && regno < NUMREGS)
                {
                  hex2mem (ptr, (char *) &registers[regno], 4, 0);
                  strcpy_s(remcomOutBuffer, BUFMAX, "OK");
                  break;
                }

            strcpy_s(remcomOutBuffer, BUFMAX, "E01");
            break;
          }

          /* mAA..AA,LLLL  Read LLLL bytes at address AA..AA */
        case 'm':
          /* TRY TO READ %x,%x.  IF SUCCEED, SET PTR = 0 */
          if (hexToInt (&ptr, &addr))
            if (*(ptr++) == ',')
              if (hexToInt (&ptr, &length))
                {
                  ptr = 0;
                  mem_err = 0;
                  mem2hex ((char *) addr, remcomOutBuffer, length, 1);
                  if (mem_err)
                    {
                      strcpy_s(remcomOutBuffer, BUFMAX, "E03");
                      debug_error ("memory fault");
                    }
                }

          if (ptr)
            {
              strcpy_s(remcomOutBuffer, BUFMAX, "E01");
            }
          break;

          /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */
        case 'M':
          /* TRY TO READ '%x,%x:'.  IF SUCCEED, SET PTR = 0 */
          if (hexToInt (&ptr, &addr))
            if (*(ptr++) == ',')
              if (hexToInt (&ptr, &length))
                if (*(ptr++) == ':')
                  {
                    mem_err = 0;
                    hex2mem (ptr, (char *) addr, length, 1);

                    if (mem_err)
                      {
                        strcpy_s(remcomOutBuffer, BUFMAX, "E03");
                        debug_error ("memory fault");
                      }
                    else
                      {
                        strcpy_s(remcomOutBuffer, BUFMAX, "OK");
                      }

                    ptr = 0;
                  }
          if (ptr)
            {
              strcpy_s(remcomOutBuffer, BUFMAX, "E02");
            }
          break;

          /* cAA..AA    Continue at address AA..AA(optional) */
          /* sAA..AA   Step one instruction from AA..AA(optional) */
        case 's':
          stepping = 1;
        case 'c':
          /* try to read optional parameter, pc unchanged if no parm */
          if (hexToInt (&ptr, &addr))
            registers[PC] = addr;

          newPC = registers[PC];

          /* clear the trace bit */
          registers[PS] &= 0xfffffeff;

          /* set the trace bit if we're stepping */
          if (stepping)
            registers[PS] |= 0x100;

#ifdef WIN32 //MF
          return;
#else
          _returnFromException ();      /* this is a jump */
#endif
          break;

          /* kill the program */
        case 'k':               /* do nothing */
#if 0
          /* Huh? This doesn't look like "nothing".
             m68k-stub.c and sparc-stub.c don't have it.  */
          BREAKPOINT ();
#endif
          break;
        }                       /* switch */

      /* reply to the request */
      putpacket (remcomOutBuffer);
    }
}

Here is the call graph for this function:

int hex ( char  ch )

Definition at line 512 of file i386-stub-win32.c.

Referenced by getpacket(), hex2mem(), and hexToInt().

{
  if ((ch >= 'a') && (ch <= 'f'))
    return (ch - 'a' + 10);
  if ((ch >= '0') && (ch <= '9'))
    return (ch - '0');
  if ((ch >= 'A') && (ch <= 'F'))
    return (ch - 'A' + 10);
  return (-1);
}

Here is the caller graph for this function:

char* hex2mem ( char *  buf,
char *  mem,
int  count,
int  may_fault 
)

Definition at line 705 of file i386-stub-win32.c.

References hex(), set_char(), and set_mem_err().

Referenced by handle_exception().

{
  int i;
  unsigned char ch;

#ifdef WIN32 //MF
   // MinGW does not support structured exception handling, so let's
   // go safe and make memory writable by default
  DWORD old_protect;

  VirtualProtect(mem, count, PAGE_EXECUTE_READWRITE, &old_protect);
#else
  if (may_fault)
    mem_fault_routine = set_mem_err;
#endif

  for (i = 0; i < count; i++)
    {
      ch = hex (*buf++) << 4;
      ch = ch + hex (*buf++);
      set_char (mem++, ch);
      if (may_fault && mem_err)
        return (mem);
    }

#ifndef WIN32 //MF
  if (may_fault)
    mem_fault_routine = NULL;
#endif

  return (mem);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int hexToInt ( char **  ptr,
int *  intValue 
)

Definition at line 806 of file i386-stub-win32.c.

References hex().

Referenced by handle_exception().

{
  int numChars = 0;
  int hexValue;

  *intValue = 0;

  while (**ptr)
    {
      hexValue = hex (**ptr);
      if (hexValue >= 0)
        {
          *intValue = (*intValue << 4) | hexValue;
          numChars++;
        }
      else
        break;

      (*ptr)++;
    }

  return (numChars);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* mem2hex ( char *  mem,
char *  buf,
int  count,
int  may_fault 
)

Definition at line 670 of file i386-stub-win32.c.

References get_char(), and set_mem_err().

Referenced by handle_exception().

{
  int i;
  unsigned char ch;

#ifdef WIN32 //MF
  if (IsBadReadPtr(mem, count))
    return mem;
#else
  if (may_fault)
    mem_fault_routine = set_mem_err;
#endif
  for (i = 0; i < count; i++)
    {
      ch = get_char (mem++);
      if (may_fault && mem_err)
        return (buf);
      *buf++ = hexchars[ch >> 4];
      *buf++ = hexchars[ch % 16];
    }
  *buf = 0;
#ifndef WIN32 //MF
  if (may_fault)
    mem_fault_routine = NULL;
#endif
  return (buf);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void putDebugChar (  )

Referenced by getpacket(), and putpacket().

Here is the caller graph for this function:

void putpacket ( char *  buffer )

Definition at line 602 of file i386-stub-win32.c.

References getDebugChar(), and putDebugChar().

Referenced by handle_exception().

{
  unsigned char checksum;
  int count;
  char ch;

  /*  $<packet info>#<checksum>. */
  do
    {
      putDebugChar ('$');
      checksum = 0;
      count = 0;

      while ((ch = buffer[count]) != 0)
        {
          putDebugChar (ch);
          checksum += ch;
          count += 1;
        }

      putDebugChar ('#');
      putDebugChar (hexchars[checksum >> 4]);
      putDebugChar (hexchars[checksum % 16]);

    }
  while (getDebugChar () != '+');
}

Here is the call graph for this function:

Here is the caller graph for this function:

void return_to_prog (  )

Referenced by _returnFromException().

Here is the caller graph for this function:

void set_char ( char *  addr,
int  val 
)

Definition at line 660 of file i386-stub-win32.c.

Referenced by hex2mem().

{
  *addr = val;
}

Here is the caller graph for this function:

void set_debug_traps ( void   )
void set_mem_err ( void   )

Definition at line 644 of file i386-stub-win32.c.

Referenced by hex2mem(), and mem2hex().

{
  mem_err = 1;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 184 of file i386-stub-win32.c.

int gdb_i386vector = -1

Definition at line 187 of file i386-stub-win32.c.

Referenced by handle_exception().

int registers[NUMREGS]

Definition at line 132 of file i386-stub-win32.c.

Referenced by handle_exception().

int remcomStack[STACKSIZE/sizeof(int)]

Definition at line 137 of file i386-stub-win32.c.

Referenced by set_debug_traps().

Definition at line 113 of file i386-stub-win32.c.

Referenced by debug_error(), getpacket(), and handle_exception().


ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage