gdbstub.c File Reference

GDB stub for remote debugging. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <byteswap.h>
#include <gpxe/gdbstub.h>
#include "gdbmach.h"

Go to the source code of this file.

Data Structures

struct  gdbstub

Enumerations

enum  { POSIX_EINVAL = 0x1c, SIZEOF_PAYLOAD = 256 }

Functions

static void gdbstub_state_new (struct gdbstub *stub, char ch)
static void gdbstub_state_data (struct gdbstub *stub, char ch)
static void gdbstub_state_cksum1 (struct gdbstub *stub, char ch)
static void gdbstub_state_cksum2 (struct gdbstub *stub, char ch)
static void gdbstub_state_wait_ack (struct gdbstub *stub, char ch)
static uint8_t gdbstub_from_hex_digit (char ch)
static uint8_t gdbstub_to_hex_digit (uint8_t b)
static void gdbstub_from_hex_buf (char *dst, char *src, int lenbytes)
static void gdbstub_to_hex_buf (char *dst, char *src, int lenbytes)
static uint8_t gdbstub_cksum (char *data, int len)
static void gdbstub_tx_packet (struct gdbstub *stub)
static void gdbstub_send_ok (struct gdbstub *stub)
static void gdbstub_send_num_packet (struct gdbstub *stub, char reply, int num)
static int gdbstub_get_packet_args (struct gdbstub *stub, unsigned long *args, int nargs, int *stop_idx)
static void gdbstub_send_errno (struct gdbstub *stub, int errno)
static void gdbstub_report_signal (struct gdbstub *stub)
static void gdbstub_read_regs (struct gdbstub *stub)
static void gdbstub_write_regs (struct gdbstub *stub)
static void gdbstub_read_mem (struct gdbstub *stub)
static void gdbstub_write_mem (struct gdbstub *stub)
static void gdbstub_continue (struct gdbstub *stub, int single_step)
static void gdbstub_breakpoint (struct gdbstub *stub)
static void gdbstub_rx_packet (struct gdbstub *stub)
static void gdbstub_parse (struct gdbstub *stub, char ch)
void gdbstub_handler (int signo, gdbreg_t *regs)
 Interrupt handler.
struct gdb_transportfind_gdb_transport (const char *name)
 Look up GDB transport by name.
void gdbstub_start (struct gdb_transport *trans)
 Break into the debugger using the given transport.

Variables

static struct gdbstub stub


Detailed Description

GDB stub for remote debugging.

Definition in file gdbstub.c.


Enumeration Type Documentation

anonymous enum

Enumerator:
POSIX_EINVAL 
SIZEOF_PAYLOAD 

Definition at line 34 of file gdbstub.c.

00034      {
00035         POSIX_EINVAL = 0x1c,  /* used to report bad arguments to GDB */
00036         SIZEOF_PAYLOAD = 256, /* buffer size of GDB payload data */
00037 };


Function Documentation

static void gdbstub_state_new ( struct gdbstub stub,
char  ch 
) [static]

Definition at line 302 of file gdbstub.c.

References gdbstub_state_data(), gdbstub::len, and gdbstub::parse.

Referenced by gdbstub_state_cksum2(), and gdbstub_state_wait_ack().

00302                                                                 {
00303         if ( ch == '$' ) {
00304                 stub->len = 0;
00305                 stub->parse = gdbstub_state_data;
00306         }
00307 }

static void gdbstub_state_data ( struct gdbstub stub,
char  ch 
) [static]

Definition at line 309 of file gdbstub.c.

References gdbstub_state_cksum1(), gdbstub::len, gdbstub::parse, gdbstub::payload, and SIZEOF_PAYLOAD.

Referenced by gdbstub_state_new().

00309                                                                  {
00310         if ( ch == '#' ) {
00311                 stub->parse = gdbstub_state_cksum1;
00312         } else if ( ch == '$' ) {
00313                 stub->len = 0; /* retry new packet */
00314         } else {
00315                 /* If the length exceeds our buffer, let the checksum fail */
00316                 if ( stub->len < SIZEOF_PAYLOAD ) {
00317                         stub->payload [ stub->len++ ] = ch;
00318                 }
00319         }
00320 }

static void gdbstub_state_cksum1 ( struct gdbstub stub,
char  ch 
) [static]

Definition at line 322 of file gdbstub.c.

References gdbstub::cksum1, gdbstub_from_hex_digit(), gdbstub_state_cksum2(), and gdbstub::parse.

Referenced by gdbstub_state_data().

00322                                                                    {
00323         stub->cksum1 = gdbstub_from_hex_digit ( ch ) << 4;
00324         stub->parse = gdbstub_state_cksum2;
00325 }

static void gdbstub_state_cksum2 ( struct gdbstub stub,
char  ch 
) [static]

Definition at line 327 of file gdbstub.c.

References gdbstub::cksum1, gdbstub_cksum(), gdbstub_from_hex_digit(), gdbstub_rx_packet(), gdbstub_state_new(), gdbstub::len, gdbstub::parse, gdbstub::payload, gdb_transport::send, and gdbstub::trans.

Referenced by gdbstub_state_cksum1().

00327                                                                    {
00328         uint8_t their_cksum;
00329         uint8_t our_cksum;
00330 
00331         stub->parse = gdbstub_state_new;
00332         their_cksum = stub->cksum1 + gdbstub_from_hex_digit ( ch );
00333         our_cksum = gdbstub_cksum ( stub->payload, stub->len );
00334         if ( their_cksum == our_cksum ) {
00335                 stub->trans->send ( "+", 1 );
00336                 if ( stub->len > 0 ) {
00337                         gdbstub_rx_packet ( stub );
00338                 }
00339         } else {
00340                 stub->trans->send ( "-", 1 );
00341         }
00342 }

static void gdbstub_state_wait_ack ( struct gdbstub stub,
char  ch 
) [static]

Definition at line 344 of file gdbstub.c.

References gdbstub_state_new(), gdbstub_tx_packet(), and gdbstub::parse.

Referenced by gdbstub_tx_packet().

00344                                                                      {
00345         if ( ch == '+' ) {
00346                 stub->parse = gdbstub_state_new;
00347         } else {
00348                 /* This retransmit is very aggressive but necessary to keep
00349                  * in sync with GDB. */
00350                 gdbstub_tx_packet ( stub );
00351         }
00352 }

static uint8_t gdbstub_from_hex_digit ( char  ch  )  [static]

Definition at line 64 of file gdbstub.c.

References isdigit, and tolower().

Referenced by gdbstub_from_hex_buf(), gdbstub_get_packet_args(), gdbstub_state_cksum1(), and gdbstub_state_cksum2().

00064                                                   {
00065         return ( isdigit ( ch ) ? ch - '0' : tolower ( ch ) - 'a' + 0xa ) & 0xf;
00066 }

static uint8_t gdbstub_to_hex_digit ( uint8_t  b  )  [static]

Definition at line 68 of file gdbstub.c.

Referenced by gdbstub_send_num_packet(), gdbstub_to_hex_buf(), and gdbstub_tx_packet().

00068                                                   {
00069         b &= 0xf;
00070         return ( b < 0xa ? '0' : 'a' - 0xa ) + b;
00071 }

static void gdbstub_from_hex_buf ( char *  dst,
char *  src,
int  lenbytes 
) [static]

Definition at line 78 of file gdbstub.c.

References cpu_to_le16, cpu_to_le32, and gdbstub_from_hex_digit().

Referenced by gdbstub_write_mem(), and gdbstub_write_regs().

00078                                                                         {
00079         if ( lenbytes == 2 && ( ( unsigned long ) dst & 0x1 ) == 0 ) {
00080                 uint16_t i = gdbstub_from_hex_digit ( src [ 2 ] ) << 12 |
00081                         gdbstub_from_hex_digit ( src [ 3 ] ) << 8 |
00082                         gdbstub_from_hex_digit ( src [ 0 ] ) << 4 |
00083                         gdbstub_from_hex_digit ( src [ 1 ] );
00084                 * ( uint16_t * ) dst = cpu_to_le16 ( i );
00085         } else if ( lenbytes == 4 && ( ( unsigned long ) dst & 0x3 ) == 0 ) {
00086                 uint32_t i = gdbstub_from_hex_digit ( src [ 6 ] ) << 28 |
00087                         gdbstub_from_hex_digit ( src [ 7 ] ) << 24 |
00088                         gdbstub_from_hex_digit ( src [ 4 ] ) << 20 |
00089                         gdbstub_from_hex_digit ( src [ 5 ] ) << 16 |
00090                         gdbstub_from_hex_digit ( src [ 2 ] ) << 12 |
00091                         gdbstub_from_hex_digit ( src [ 3 ] ) << 8 |
00092                         gdbstub_from_hex_digit ( src [ 0 ] ) << 4 |
00093                         gdbstub_from_hex_digit ( src [ 1 ] );
00094                 * ( uint32_t * ) dst = cpu_to_le32 ( i );
00095         } else {
00096                 while ( lenbytes-- > 0 ) {
00097                         *dst++ = gdbstub_from_hex_digit ( src [ 0 ] ) << 4 |
00098                                 gdbstub_from_hex_digit ( src [ 1 ] );
00099                         src += 2;
00100                 }
00101         }
00102 }

static void gdbstub_to_hex_buf ( char *  dst,
char *  src,
int  lenbytes 
) [static]

Definition at line 104 of file gdbstub.c.

References cpu_to_le16, cpu_to_le32, and gdbstub_to_hex_digit().

Referenced by gdbstub_read_mem(), and gdbstub_read_regs().

00104                                                                       {
00105         if ( lenbytes == 2 && ( ( unsigned long ) src & 0x1 ) == 0 ) {
00106                 uint16_t i = cpu_to_le16 ( * ( uint16_t * ) src );
00107                 dst [ 0 ] = gdbstub_to_hex_digit ( i >> 4 );
00108                 dst [ 1 ] = gdbstub_to_hex_digit ( i );
00109                 dst [ 2 ] = gdbstub_to_hex_digit ( i >> 12 );
00110                 dst [ 3 ] = gdbstub_to_hex_digit ( i >> 8 );
00111         } else if ( lenbytes == 4 && ( ( unsigned long ) src & 0x3 ) == 0 ) {
00112                 uint32_t i = cpu_to_le32 ( * ( uint32_t * ) src );
00113                 dst [ 0 ] = gdbstub_to_hex_digit ( i >> 4 );
00114                 dst [ 1 ] = gdbstub_to_hex_digit ( i );
00115                 dst [ 2 ] = gdbstub_to_hex_digit ( i >> 12 );
00116                 dst [ 3 ] = gdbstub_to_hex_digit ( i >> 8 );
00117                 dst [ 4 ] = gdbstub_to_hex_digit ( i >> 20 );
00118                 dst [ 5 ] = gdbstub_to_hex_digit ( i >> 16);
00119                 dst [ 6 ] = gdbstub_to_hex_digit ( i >> 28 );
00120                 dst [ 7 ] = gdbstub_to_hex_digit ( i >> 24 );
00121         } else {
00122                 while ( lenbytes-- > 0 ) {
00123                         *dst++ = gdbstub_to_hex_digit ( *src >> 4 );
00124                         *dst++ = gdbstub_to_hex_digit ( *src );
00125                         src++;
00126                 }
00127         }
00128 }

static uint8_t gdbstub_cksum ( char *  data,
int  len 
) [static]

Definition at line 130 of file gdbstub.c.

Referenced by gdbstub_state_cksum2(), and gdbstub_tx_packet().

00130                                                      {
00131         uint8_t cksum = 0;
00132         while ( len-- > 0 ) {
00133                 cksum += ( uint8_t ) *data++;
00134         }
00135         return cksum;
00136 }

static void gdbstub_tx_packet ( struct gdbstub stub  )  [static]

Definition at line 138 of file gdbstub.c.

References gdbstub::buf, gdbstub_cksum(), gdbstub_state_wait_ack(), gdbstub_to_hex_digit(), gdbstub::len, gdbstub::parse, gdbstub::payload, gdb_transport::send, and gdbstub::trans.

Referenced by gdbstub_breakpoint(), gdbstub_read_mem(), gdbstub_read_regs(), gdbstub_rx_packet(), gdbstub_send_num_packet(), gdbstub_send_ok(), and gdbstub_state_wait_ack().

00138                                                        {
00139         uint8_t cksum = gdbstub_cksum ( stub->payload, stub->len );
00140         stub->buf [ 0 ] = '$';
00141         stub->buf [ stub->len + 1 ] = '#';
00142         stub->buf [ stub->len + 2 ] = gdbstub_to_hex_digit ( cksum >> 4 );
00143         stub->buf [ stub->len + 3 ] = gdbstub_to_hex_digit ( cksum );
00144         stub->trans->send ( stub->buf, stub->len + 4 );
00145         stub->parse = gdbstub_state_wait_ack;
00146 }

static void gdbstub_send_ok ( struct gdbstub stub  )  [static]

Definition at line 149 of file gdbstub.c.

References gdbstub_tx_packet(), gdbstub::len, and gdbstub::payload.

Referenced by gdbstub_breakpoint(), gdbstub_rx_packet(), gdbstub_write_mem(), and gdbstub_write_regs().

00149                                                      {
00150         stub->payload [ 0 ] = 'O';
00151         stub->payload [ 1 ] = 'K';
00152         stub->len = 2;
00153         gdbstub_tx_packet ( stub );
00154 }

static void gdbstub_send_num_packet ( struct gdbstub stub,
char  reply,
int  num 
) [static]

Definition at line 156 of file gdbstub.c.

References gdbstub_to_hex_digit(), gdbstub_tx_packet(), gdbstub::len, and gdbstub::payload.

Referenced by gdbstub_report_signal(), and gdbstub_send_errno().

00156                                                                                   {
00157         stub->payload [ 0 ] = reply;
00158         stub->payload [ 1 ] = gdbstub_to_hex_digit ( ( char ) num >> 4 );
00159         stub->payload [ 2 ] = gdbstub_to_hex_digit ( ( char ) num );
00160         stub->len = 3;
00161         gdbstub_tx_packet ( stub );
00162 }

static int gdbstub_get_packet_args ( struct gdbstub stub,
unsigned long *  args,
int  nargs,
int *  stop_idx 
) [static]

Definition at line 165 of file gdbstub.c.

References gdbstub_from_hex_digit(), gdbstub::len, and gdbstub::payload.

Referenced by gdbstub_breakpoint(), gdbstub_continue(), gdbstub_read_mem(), and gdbstub_write_mem().

00165                                                                                                            {
00166         int i;
00167         char ch = 0;
00168         int argc = 0;
00169         unsigned long val = 0;
00170         for ( i = 1; i < stub->len && argc < nargs; i++ ) {
00171                 ch = stub->payload [ i ];
00172                 if ( ch == ':' ) {
00173                         break;
00174                 } else if ( ch == ',' ) {
00175                         args [ argc++ ] = val;
00176                         val = 0;
00177                 } else {
00178                         val = ( val << 4 ) | gdbstub_from_hex_digit ( ch );
00179                 }
00180         }
00181         if ( stop_idx ) {
00182                 *stop_idx = i;
00183         }
00184         if ( argc < nargs ) {
00185                 args [ argc++ ] = val;
00186         }
00187         return ( ( i == stub->len || ch == ':' ) && argc == nargs );
00188 }

static void gdbstub_send_errno ( struct gdbstub stub,
int  errno 
) [static]

Definition at line 190 of file gdbstub.c.

References gdbstub_send_num_packet().

Referenced by gdbstub_breakpoint(), gdbstub_read_mem(), gdbstub_write_mem(), and gdbstub_write_regs().

00190                                                                    {
00191         gdbstub_send_num_packet ( stub, 'E', errno );
00192 }

static void gdbstub_report_signal ( struct gdbstub stub  )  [static]

Definition at line 194 of file gdbstub.c.

References gdbstub_send_num_packet(), and gdbstub::signo.

Referenced by gdbstub_handler(), and gdbstub_rx_packet().

00194                                                            {
00195         gdbstub_send_num_packet ( stub, 'S', stub->signo );
00196 }

static void gdbstub_read_regs ( struct gdbstub stub  )  [static]

Definition at line 198 of file gdbstub.c.

References GDBMACH_SIZEOF_REGS, gdbstub_to_hex_buf(), gdbstub_tx_packet(), gdbstub::len, gdbstub::payload, and gdbstub::regs.

Referenced by gdbstub_rx_packet().

00198                                                        {
00199         gdbstub_to_hex_buf ( stub->payload, ( char * ) stub->regs, GDBMACH_SIZEOF_REGS );
00200         stub->len = GDBMACH_SIZEOF_REGS * 2;
00201         gdbstub_tx_packet ( stub );
00202 }

static void gdbstub_write_regs ( struct gdbstub stub  )  [static]

Definition at line 204 of file gdbstub.c.

References GDBMACH_SIZEOF_REGS, gdbstub_from_hex_buf(), gdbstub_send_errno(), gdbstub_send_ok(), gdbstub::len, gdbstub::payload, POSIX_EINVAL, and gdbstub::regs.

Referenced by gdbstub_rx_packet().

00204                                                         {
00205         if ( stub->len != 1 + GDBMACH_SIZEOF_REGS * 2 ) {
00206                 gdbstub_send_errno ( stub, POSIX_EINVAL );
00207                 return;
00208         }
00209         gdbstub_from_hex_buf ( ( char * ) stub->regs, &stub->payload [ 1 ], GDBMACH_SIZEOF_REGS );
00210         gdbstub_send_ok ( stub );
00211 }

static void gdbstub_read_mem ( struct gdbstub stub  )  [static]

Definition at line 213 of file gdbstub.c.

References gdbstub_get_packet_args(), gdbstub_send_errno(), gdbstub_to_hex_buf(), gdbstub_tx_packet(), gdbstub::len, NULL, gdbstub::payload, POSIX_EINVAL, and SIZEOF_PAYLOAD.

Referenced by gdbstub_rx_packet().

00213                                                       {
00214         unsigned long args [ 2 ];
00215         if ( !gdbstub_get_packet_args ( stub, args, sizeof args / sizeof args [ 0 ], NULL ) ) {
00216                 gdbstub_send_errno ( stub, POSIX_EINVAL );
00217                 return;
00218         }
00219         args [ 1 ] = ( args [ 1 ] < SIZEOF_PAYLOAD / 2 ) ? args [ 1 ] : SIZEOF_PAYLOAD / 2;
00220         gdbstub_to_hex_buf ( stub->payload, ( char * ) args [ 0 ], args [ 1 ] );
00221         stub->len = args [ 1 ] * 2;
00222         gdbstub_tx_packet ( stub );
00223 }

static void gdbstub_write_mem ( struct gdbstub stub  )  [static]

Definition at line 225 of file gdbstub.c.

References gdbstub_from_hex_buf(), gdbstub_get_packet_args(), gdbstub_send_errno(), gdbstub_send_ok(), gdbstub::len, gdbstub::payload, and POSIX_EINVAL.

Referenced by gdbstub_rx_packet().

00225                                                        {
00226         unsigned long args [ 2 ];
00227         int colon;
00228         if ( !gdbstub_get_packet_args ( stub, args, sizeof args / sizeof args [ 0 ], &colon ) ||
00229                         colon >= stub->len || stub->payload [ colon ] != ':' ||
00230                         ( stub->len - colon - 1 ) % 2 != 0 ) {
00231                 gdbstub_send_errno ( stub, POSIX_EINVAL );
00232                 return;
00233         }
00234         gdbstub_from_hex_buf ( ( char * ) args [ 0 ], &stub->payload [ colon + 1 ], ( stub->len - colon - 1 ) / 2 );
00235         gdbstub_send_ok ( stub );
00236 }

static void gdbstub_continue ( struct gdbstub stub,
int  single_step 
) [static]

Definition at line 238 of file gdbstub.c.

References gdbstub::exit_handler, gdbmach_set_pc(), gdbmach_set_single_step(), gdbstub_get_packet_args(), gdbstub::len, NULL, and gdbstub::regs.

Referenced by gdbstub_rx_packet().

00238                                                                        {
00239         gdbreg_t pc;
00240         if ( stub->len > 1 && gdbstub_get_packet_args ( stub, &pc, 1, NULL ) ) {
00241                 gdbmach_set_pc ( stub->regs, pc );
00242         }
00243         gdbmach_set_single_step ( stub->regs, single_step );
00244         stub->exit_handler = 1;
00245         /* Reply will be sent when we hit the next breakpoint or interrupt */
00246 }

static void gdbstub_breakpoint ( struct gdbstub stub  )  [static]

Definition at line 248 of file gdbstub.c.

References gdbmach_set_breakpoint(), gdbstub_get_packet_args(), gdbstub_send_errno(), gdbstub_send_ok(), gdbstub_tx_packet(), gdbstub::len, NULL, gdbstub::payload, and POSIX_EINVAL.

Referenced by gdbstub_rx_packet().

00248                                                         {
00249         unsigned long args [ 3 ];
00250         int enable = stub->payload [ 0 ] == 'Z' ? 1 : 0;
00251         if ( !gdbstub_get_packet_args ( stub, args, sizeof args / sizeof args [ 0 ], NULL ) ) {
00252                 gdbstub_send_errno ( stub, POSIX_EINVAL );
00253                 return;
00254         }
00255         if ( gdbmach_set_breakpoint ( args [ 0 ], args [ 1 ], args [ 2 ], enable ) ) {
00256                 gdbstub_send_ok ( stub );
00257         } else {
00258                 /* Not supported */
00259                 stub->len = 0;
00260                 gdbstub_tx_packet ( stub );
00261         }
00262 }

static void gdbstub_rx_packet ( struct gdbstub stub  )  [static]

Definition at line 264 of file gdbstub.c.

References gdbstub_breakpoint(), gdbstub_continue(), gdbstub_read_mem(), gdbstub_read_regs(), gdbstub_report_signal(), gdbstub_send_ok(), gdbstub_tx_packet(), gdbstub_write_mem(), gdbstub_write_regs(), gdbstub::len, and gdbstub::payload.

Referenced by gdbstub_state_cksum2().

00264                                                        {
00265         switch ( stub->payload [ 0 ] ) {
00266                 case '?':
00267                         gdbstub_report_signal ( stub );
00268                         break;
00269                 case 'g':
00270                         gdbstub_read_regs ( stub );
00271                         break;
00272                 case 'G':
00273                         gdbstub_write_regs ( stub );
00274                         break;
00275                 case 'm':
00276                         gdbstub_read_mem ( stub );
00277                         break;
00278                 case 'M':
00279                         gdbstub_write_mem ( stub );
00280                         break;
00281                 case 'c': /* Continue */
00282                 case 'k': /* Kill */
00283                 case 's': /* Step */
00284                 case 'D': /* Detach */
00285                         gdbstub_continue ( stub, stub->payload [ 0 ] == 's' );
00286                         if ( stub->payload [ 0 ] == 'D' ) {
00287                                 gdbstub_send_ok ( stub );
00288                         }
00289                         break;
00290                 case 'Z': /* Insert breakpoint */
00291                 case 'z': /* Remove breakpoint */
00292                         gdbstub_breakpoint ( stub );
00293                         break;
00294                 default:
00295                         stub->len = 0;
00296                         gdbstub_tx_packet ( stub );
00297                         break;
00298         }
00299 }

static void gdbstub_parse ( struct gdbstub stub,
char  ch 
) [static]

Definition at line 354 of file gdbstub.c.

References gdbstub::parse.

Referenced by gdbstub_handler().

00354                                                             {
00355         stub->parse ( stub, ch );
00356 }

void gdbstub_handler ( int  signo,
gdbreg_t regs 
)

Interrupt handler.

POSIX signal number CPU register snapshot

Definition at line 362 of file gdbstub.c.

References gdbstub::exit_handler, gdbstub_parse(), gdbstub_report_signal(), gdbstub::len, gdb_transport::recv, gdbstub::regs, gdbstub::signo, SIZEOF_PAYLOAD, and gdbstub::trans.

Referenced by gdbmach_handler().

00362                                                    {
00363         char packet [ SIZEOF_PAYLOAD + 4 ];
00364         size_t len, i;
00365 
00366         /* A transport must be set up */
00367         if ( !stub.trans ) {
00368                 return;
00369         }
00370 
00371         stub.signo = signo;
00372         stub.regs = regs;
00373         stub.exit_handler = 0;
00374         gdbstub_report_signal ( &stub );
00375         while ( !stub.exit_handler && ( len = stub.trans->recv ( packet, sizeof ( packet ) ) ) > 0 ) {
00376                 for ( i = 0; i < len; i++ ) {
00377                         gdbstub_parse ( &stub, packet [ i ] );
00378                 }
00379         }
00380 }

struct gdb_transport* find_gdb_transport ( const char *  name  )  [read]

Look up GDB transport by name.

Parameters:
name Name of transport
Return values:
GDB transport or NULL

Definition at line 382 of file gdbstub.c.

References for_each_table_entry, GDB_TRANSPORTS, gdb_transport::name, NULL, and strcmp().

Referenced by gdbstub_exec().

00382                                                               {
00383         struct gdb_transport *trans;
00384 
00385         for_each_table_entry ( trans, GDB_TRANSPORTS ) {
00386                 if ( strcmp ( trans->name, name ) == 0 ) {
00387                         return trans;
00388                 }
00389         }
00390         return NULL;
00391 }

void gdbstub_start ( struct gdb_transport trans  ) 

Break into the debugger using the given transport.

Parameters:
trans GDB transport

Definition at line 393 of file gdbstub.c.

References gdbstub::buf, gdbmach_breakpoint(), gdbstub::payload, and gdbstub::trans.

Referenced by gdbstub_exec().

00393                                                    {
00394         stub.trans = trans;
00395         stub.payload = &stub.buf [ 1 ];
00396         gdbmach_breakpoint();
00397 }


Variable Documentation

struct gdbstub stub [static]

Initial value:

 {
        .parse = gdbstub_state_new
}

Definition at line 358 of file gdbstub.c.


Generated on Tue Apr 6 20:01:14 2010 for gPXE by  doxygen 1.5.7.1