iPXE
|
GDB stub for remote debugging. More...
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <byteswap.h>
#include <ipxe/gdbstub.h>
Go to the source code of this file.
Data Structures | |
struct | gdbstub |
Enumerations | |
enum | { POSIX_EINVAL = 0x1c, SIZEOF_PAYLOAD = 512 } |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
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. More... | |
struct gdb_transport * | find_gdb_transport (const char *name) |
Look up GDB transport by name. More... | |
void | gdbstub_start (struct gdb_transport *trans) |
Break into the debugger using the given transport. More... | |
Variables | |
static struct gdbstub | stub |
GDB stub for remote debugging.
Definition in file gdbstub.c.
anonymous enum |
Enumerator | |
---|---|
POSIX_EINVAL | |
SIZEOF_PAYLOAD |
Definition at line 40 of file gdbstub.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Definition at line 311 of file gdbstub.c.
References ch, gdbstub_state_data(), gdbstub::len, gdbstub::parse, and stub.
Referenced by gdbstub_state_cksum2(), and gdbstub_state_wait_ack().
|
static |
Definition at line 318 of file gdbstub.c.
References ch, gdbstub_state_cksum1(), gdbstub::len, gdbstub::parse, gdbstub::payload, SIZEOF_PAYLOAD, and stub.
Referenced by gdbstub_state_new().
|
static |
Definition at line 331 of file gdbstub.c.
References ch, gdbstub::cksum1, gdbstub_from_hex_digit(), gdbstub_state_cksum2(), gdbstub::parse, and stub.
Referenced by gdbstub_state_data().
|
static |
Definition at line 336 of file gdbstub.c.
References ch, gdbstub::cksum1, gdbstub_cksum(), gdbstub_from_hex_digit(), gdbstub_rx_packet(), gdbstub_state_new(), gdbstub::len, gdbstub::parse, gdbstub::payload, gdb_transport::send, stub, and gdbstub::trans.
Referenced by gdbstub_state_cksum1().
|
static |
Definition at line 353 of file gdbstub.c.
References ch, gdbstub_state_new(), gdbstub_tx_packet(), gdbstub::parse, and stub.
Referenced by gdbstub_tx_packet().
|
static |
Definition at line 70 of file gdbstub.c.
References ch, isdigit(), and tolower().
Referenced by gdbstub_from_hex_buf(), gdbstub_get_packet_args(), gdbstub_state_cksum1(), and gdbstub_state_cksum2().
Definition at line 74 of file gdbstub.c.
Referenced by gdbstub_send_num_packet(), gdbstub_to_hex_buf(), and gdbstub_tx_packet().
|
static |
Definition at line 84 of file gdbstub.c.
References cpu_to_le16, cpu_to_le32, gdbstub_from_hex_digit(), and src.
Referenced by gdbstub_write_mem(), and gdbstub_write_regs().
|
static |
Definition at line 110 of file gdbstub.c.
References cpu_to_le16, cpu_to_le32, gdbstub_to_hex_digit(), and src.
Referenced by gdbstub_read_mem(), and gdbstub_read_regs().
|
static |
Definition at line 136 of file gdbstub.c.
Referenced by gdbstub_state_cksum2(), and gdbstub_tx_packet().
|
static |
Definition at line 144 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, stub, 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().
|
static |
Definition at line 155 of file gdbstub.c.
References gdbstub_tx_packet(), gdbstub::len, gdbstub::payload, and stub.
Referenced by gdbstub_breakpoint(), gdbstub_rx_packet(), gdbstub_write_mem(), and gdbstub_write_regs().
|
static |
Definition at line 162 of file gdbstub.c.
References gdbstub_to_hex_digit(), gdbstub_tx_packet(), gdbstub::len, num, gdbstub::payload, and stub.
Referenced by gdbstub_report_signal(), and gdbstub_send_errno().
|
static |
Definition at line 171 of file gdbstub.c.
References ch, gdbstub_from_hex_digit(), gdbstub::len, gdbstub::payload, stub, and val.
Referenced by gdbstub_breakpoint(), gdbstub_continue(), gdbstub_read_mem(), and gdbstub_write_mem().
|
static |
Definition at line 196 of file gdbstub.c.
References errno, gdbstub_send_num_packet(), and stub.
Referenced by gdbstub_breakpoint(), gdbstub_read_mem(), gdbstub_write_mem(), and gdbstub_write_regs().
|
static |
Definition at line 200 of file gdbstub.c.
References gdbstub_send_num_packet(), gdbstub::signo, and stub.
Referenced by gdbstub_handler(), and gdbstub_rx_packet().
|
static |
Definition at line 204 of file gdbstub.c.
References GDBMACH_SIZEOF_REGS, gdbstub_to_hex_buf(), gdbstub_tx_packet(), gdbstub::len, gdbstub::payload, gdbstub::regs, and stub.
Referenced by gdbstub_rx_packet().
|
static |
Definition at line 210 of file gdbstub.c.
References GDBMACH_SIZEOF_REGS, gdbstub_from_hex_buf(), gdbstub_send_errno(), gdbstub_send_ok(), gdbstub::len, gdbstub::payload, POSIX_EINVAL, gdbstub::regs, and stub.
Referenced by gdbstub_rx_packet().
|
static |
Definition at line 219 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, SIZEOF_PAYLOAD, and stub.
Referenced by gdbstub_rx_packet().
|
static |
Definition at line 231 of file gdbstub.c.
References gdbstub_from_hex_buf(), gdbstub_get_packet_args(), gdbstub_send_errno(), gdbstub_send_ok(), gdbstub::len, gdbstub::payload, POSIX_EINVAL, and stub.
Referenced by gdbstub_rx_packet().
|
static |
Definition at line 244 of file gdbstub.c.
References gdbstub::exit_handler, gdbmach_set_pc(), gdbmach_set_single_step(), gdbstub_get_packet_args(), gdbstub::len, NULL, gdbstub::regs, and stub.
Referenced by gdbstub_rx_packet().
|
static |
Definition at line 254 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, POSIX_EINVAL, rc, and stub.
Referenced by gdbstub_rx_packet().
|
static |
Definition at line 273 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, gdbstub::payload, and stub.
Referenced by gdbstub_state_cksum2().
|
static |
Definition at line 363 of file gdbstub.c.
References ch, gdbstub::parse, and stub.
Referenced by gdbstub_handler().
void gdbstub_handler | ( | int | signo, |
gdbreg_t * | regs | ||
) |
Interrupt handler.
@signo POSIX signal number @regs CPU register snapshot
Definition at line 371 of file gdbstub.c.
References gdbstub::exit_handler, gdbstub_parse(), gdbstub_report_signal(), len, gdb_transport::recv, gdbstub::regs, regs, gdbstub::signo, SIZEOF_PAYLOAD, stub, and gdbstub::trans.
Referenced by gdbmach_handler().
struct gdb_transport* find_gdb_transport | ( | const char * | name | ) |
Look up GDB transport by name.
name | Name of transport |
GDB | transport or NULL |
Definition at line 391 of file gdbstub.c.
References for_each_table_entry, GDB_TRANSPORTS, gdb_transport::name, name, NULL, and strcmp().
Referenced by parse_gdb_transport().
void gdbstub_start | ( | struct gdb_transport * | trans | ) |
Break into the debugger using the given transport.
trans | GDB transport |
Definition at line 402 of file gdbstub.c.
References gdbstub::buf, gdbmach_breakpoint(), gdbmach_init(), gdbstub::payload, stub, and gdbstub::trans.
Referenced by gdbstub_exec().
|
static |
Definition at line 367 of file gdbstub.c.
Referenced by gdbstub_breakpoint(), gdbstub_continue(), gdbstub_get_packet_args(), gdbstub_handler(), gdbstub_parse(), gdbstub_read_mem(), gdbstub_read_regs(), gdbstub_report_signal(), gdbstub_rx_packet(), gdbstub_send_errno(), gdbstub_send_num_packet(), gdbstub_send_ok(), gdbstub_start(), gdbstub_state_cksum1(), gdbstub_state_cksum2(), gdbstub_state_data(), gdbstub_state_new(), gdbstub_state_wait_ack(), gdbstub_tx_packet(), gdbstub_write_mem(), and gdbstub_write_regs().