gdbstub.h File Reference

GDB remote debugging. More...

#include <stdint.h>
#include <gpxe/tables.h>
#include <gdbmach.h>

Go to the source code of this file.

Data Structures

struct  gdb_transport
 A transport mechanism for the GDB protocol. More...

Defines

#define GDB_TRANSPORTS   __table ( struct gdb_transport, "gdb_transports" )
#define __gdb_transport   __table_entry ( GDB_TRANSPORTS, 01 )

Functions

 FILE_LICENCE (GPL2_OR_LATER)
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.
void gdbstub_handler (int signo, gdbreg_t *regs)
 Interrupt handler.


Detailed Description

GDB remote debugging.

Definition in file gdbstub.h.


Define Documentation

#define GDB_TRANSPORTS   __table ( struct gdb_transport, "gdb_transports" )

Definition at line 50 of file gdbstub.h.

Referenced by find_gdb_transport().

struct gdb_transport udp_gdb_transport __gdb_transport   __table_entry ( GDB_TRANSPORTS, 01 ) [read]

Definition at line 52 of file gdbstub.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

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 }

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 }


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