iPXE
Data Structures | Defines | Functions
gdbstub.h File Reference

GDB remote debugging. More...

#include <stdint.h>
#include <ipxe/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_OR_UBDL)
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 )

Definition at line 52 of file gdbstub.h.


Function Documentation

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

Look up GDB transport by name.

Parameters:
nameName of transport
Return values:
GDBtransport or NULL

Definition at line 392 of file gdbstub.c.

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

Referenced by parse_gdb_transport().

                                                              {
        struct gdb_transport *trans;

        for_each_table_entry ( trans, GDB_TRANSPORTS ) {
                if ( strcmp ( trans->name, name ) == 0 ) {
                        return trans;
                }
        }
        return NULL;
}
void gdbstub_start ( struct gdb_transport trans)

Break into the debugger using the given transport.

Parameters:
transGDB transport

Definition at line 403 of file gdbstub.c.

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

Referenced by gdbstub_exec().

                                                   {
        stub.trans = trans;
        stub.payload = &stub.buf [ 1 ];
        gdbmach_init();
        gdbmach_breakpoint();
}
void gdbstub_handler ( int  signo,
gdbreg_t regs 
)

Interrupt handler.

POSIX signal number CPU register snapshot

Definition at line 372 of file gdbstub.c.

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

Referenced by gdbmach_handler().

                                                   {
        char packet [ SIZEOF_PAYLOAD + 4 ];
        size_t len, i;

        /* A transport must be set up */
        if ( !stub.trans ) {
                return;
        }

        stub.signo = signo;
        stub.regs = regs;
        stub.exit_handler = 0;
        gdbstub_report_signal ( &stub );
        while ( !stub.exit_handler && ( len = stub.trans->recv ( packet, sizeof ( packet ) ) ) > 0 ) {
                for ( i = 0; i < len; i++ ) {
                        gdbstub_parse ( &stub, packet [ i ] );
                }
        }
}