iPXE
gdbstub.h File Reference

GDB remote debugging. More...

#include <stdint.h>
#include <ipxe/tables.h>
#include <bits/gdbmach.h>

Go to the source code of this file.

Data Structures

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

Macros

#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)
 FILE_SECBOOT (FORBIDDEN)
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.

Macro Definition Documentation

◆ GDB_TRANSPORTS

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

Definition at line 51 of file gdbstub.h.

Referenced by find_gdb_transport().

◆ __gdb_transport

struct gdb_transport udp_gdb_transport __gdb_transport   __table_entry ( GDB_TRANSPORTS, 01 )

Definition at line 53 of file gdbstub.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( FORBIDDEN )

◆ find_gdb_transport()

struct gdb_transport * find_gdb_transport ( const char * name)
extern

Look up GDB transport by name.

Parameters
nameName of transport
Return values
GDBtransport or NULL

Definition at line 392 of file gdbstub.c.

392 {
393 struct gdb_transport *trans;
394
396 if ( strcmp ( trans->name, name ) == 0 ) {
397 return trans;
398 }
399 }
400 return NULL;
401}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
const char * name
Definition ath9k_hw.c:1986
#define GDB_TRANSPORTS
Definition gdbstub.h:51
int strcmp(const char *first, const char *second)
Compare strings.
Definition string.c:174
A transport mechanism for the GDB protocol.
Definition gdbstub.h:21
const char * name
Transport name.
Definition gdbstub.h:23
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition tables.h:386

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

Referenced by parse_gdb_transport().

◆ gdbstub_start()

void gdbstub_start ( struct gdb_transport * trans)
extern

Break into the debugger using the given transport.

Parameters
transGDB transport

Definition at line 403 of file gdbstub.c.

403 {
404 stub.trans = trans;
405 stub.payload = &stub.buf [ 1 ];
406 gdbmach_init();
408}
static void gdbmach_breakpoint(void)
Definition gdbmach.h:66
void gdbmach_init(void)
Initialise GDB.
Definition gdbmach.c:242
static struct gdbstub stub
Definition gdbstub.c:368

References gdbmach_breakpoint(), gdbmach_init(), and stub.

Referenced by gdbstub_exec().

◆ gdbstub_handler()

void gdbstub_handler ( int signo,
gdbreg_t * regs )
extern

Interrupt handler.

@signo POSIX signal number @regs CPU register snapshot

Definition at line 372 of file gdbstub.c.

372 {
373 char packet [ SIZEOF_PAYLOAD + 4 ];
374 size_t len, i;
375
376 /* A transport must be set up */
377 if ( !stub.trans ) {
378 return;
379 }
380
381 stub.signo = signo;
382 stub.regs = regs;
383 stub.exit_handler = 0;
385 while ( !stub.exit_handler && ( len = stub.trans->recv ( packet, sizeof ( packet ) ) ) > 0 ) {
386 for ( i = 0; i < len; i++ ) {
387 gdbstub_parse ( &stub, packet [ i ] );
388 }
389 }
390}
ring len
Length.
Definition dwmac.h:226
static void gdbstub_parse(struct gdbstub *stub, char ch)
Definition gdbstub.c:364
static void gdbstub_report_signal(struct gdbstub *stub)
Definition gdbstub.c:201
@ SIZEOF_PAYLOAD
Definition gdbstub.c:43
struct i386_regs regs
Definition registers.h:1

References gdbstub_parse(), gdbstub_report_signal(), len, regs, gdbstub::signo, SIZEOF_PAYLOAD, and stub.

Referenced by gdbmach_handler().