Files | |
file | debug.c |
Functions | |
void | set_mem_fault_trap () |
void | debuglog (int level, char *msg) |
print debug messages. More... | |
int | hex2digit (int digit) |
converts an ascii hex digit to a number. More... | |
char | digit2hex (int digit) |
convert number NIB to a hex digit. More... | |
unsigned char * | mem2hex (unsigned char *mem, unsigned char *buf, int count, int may_fault) |
converts a memory block to hex and stores it in buf. More... | |
unsigned char * | hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault) |
Convert the hex array pointed to by buf into binary to be placed in mem. More... | |
int | hex2int (char **ptr, int *intValue) |
while we find nice hex chars, build an int. More... | |
void | getpacket (unsigned char *buffer) |
Scan for the sequence $<data>#<checksum>. More... | |
void | putpacket (unsigned char *buffer) |
Send the packet in buffer. More... | |
void | gdb_event_loop (int sigval, unsigned long *registers) |
This is the gdb event loop waiting for GDB commands. More... | |
char * | make_return_packet (int val) |
make a return packet. More... | |
char * | gdb_read_registers () |
g - read registers. More... | |
char * | gdb_write_registers (char *regs) |
G - write registers. More... | |
char * | gdb_read_memory (long addr, int nbytes) |
m - read memory. More... | |
char * | gdb_write_memory (long addr, int nbytes, char *mem) |
M write memory. More... | |
char * | gdb_continue (int sig, long addr) |
c - continue at address. More... | |
char * | gdb_step (int sig, long addr) |
s - step instruction(s). More... | |
char * | gdb_kill () |
k - kill program. More... | |
char * | gdb_last_signal (int val) |
? - last signal. More... | |
char * | gdb_baudrate (int baud) |
b - change baud rate. More... | |
char * | gdb_dump_state () |
T - dump state. More... | |
char * | gdb_detach () |
D - host requests a detach. More... | |
char * | gdb_set_thread (int cmd, int tid) |
H - set thread. More... | |
char * | gdb_read_reg (int reg) |
p - read one register. More... | |
char * | gdb_write_reg (int reg, long val) |
P - write one register. More... | |
char * | gdb_exited () |
W - process exited. More... | |
char * | gdb_terminated () |
X - process terminated. More... | |
char * | gdb_hex (char *str, int nbytes) |
O - hex encoding. More... | |
char * | gdb_thread_alive (int tid) |
A - tread alive request. More... | |
char * | gdb_extended () |
! - extended protocol. More... | |
char * | gdb_debug () |
d - toggle gdb stub diagnostics. More... | |
char * | gdb_toggle () |
d - toggle gdb stub. More... | |
char * | gdb_reset () |
r - reset target. More... | |
char * | gdb_search (long addr, long pat, long mask) |
t - search backwards. More... | |
char * | gdb_get_query (char *query) |
q - general get query. More... | |
char * | gdb_set (char *query) |
Q - general set query. More... | |
Variables | |
volatile int | mem_err = 0 |
int | remote_debug = 0 |
int | initialized = 0 |
trap_info | hard_trap_info [] |
|
print debug messages. This uses print, rather than one of the stdio routines, cause if there are stack or memory problems, the stdio routines don't work.
Definition at line 121 of file debug.c. References BUFMAX, print, and remote_debug. |
|
convert number NIB to a hex digit.
Definition at line 211 of file debug.c. Referenced by putpacket. |
|
b - change baud rate.
Definition at line 702 of file debug.c. References make_return_packet. |
|
c - continue at address.
|
|
d - toggle gdb stub diagnostics. returns an OK or an error number. Definition at line 862 of file debug.c. References make_return_packet, and remote_debug. |
|
D - host requests a detach. returns either a S, T, W, or X command. returns an OK or an error number. |
|
T - dump state. returns the signal number, the registers, the thread ID, and possible extensions in a vector that looks like: TAAn...:r...;n...:r...;n...:r...; where: AA = signal number n... = register number (hex) r... = register contents n... = `thread' r... = thread process ID. This is a hex integer. n... = other string not starting with valid hex digit. gdb should ignore this n,r pair and go on to the next. This way we can extend the protocol. |
|
This is the gdb event loop waiting for GDB commands.
Definition at line 418 of file debug.c. References DEBUG, gdb_kill, gdb_last_signal, gdb_read_memory, gdb_toggle, gdb_write_memory, getpacket, hex2int, make_return_packet, packet_in_buf, packet_out_buf, and putpacket. |
|
W - process exited. returns the exit status. Definition at line 798 of file debug.c. References make_return_packet. |
|
! - extended protocol. returns an OK or an error number. Definition at line 849 of file debug.c. References make_return_packet. |
|
q - general get query.
Definition at line 930 of file debug.c. References make_return_packet. |
|
O - hex encoding.
|
|
k - kill program. returns an OK or an error number. Definition at line 668 of file debug.c. References make_return_packet. Referenced by gdb_event_loop. |
|
? - last signal. returns the last signal number. Definition at line 681 of file debug.c. References DEBUG, digit2hex, and packet_out_buf. |
|
m - read memory.
Definition at line 607 of file debug.c. References make_return_packet, MAY_FAULT, mem2hex, and packet_out_buf. |
|
p - read one register.
Definition at line 769 of file debug.c. References make_return_packet. |
|
g - read registers. returns a vector of words, size is NUM_REGS. |
|
r - reset target. returns an OK or an error number. Definition at line 900 of file debug.c. References make_return_packet. |
|
t - search backwards.
Definition at line 916 of file debug.c. References make_return_packet. |
|
Q - general set query.
Definition at line 945 of file debug.c. References make_return_packet. |
|
H - set thread.
Definition at line 755 of file debug.c. References make_return_packet. |
|
s - step instruction(s).
|
|
X - process terminated. returns the last signal. |
|
A - tread alive request.
Definition at line 836 of file debug.c. References make_return_packet. |
|
d - toggle gdb stub. returns an OK or an error number. Definition at line 879 of file debug.c. References make_return_packet, and remote_debug. Referenced by gdb_event_loop. |
|
M write memory.
Definition at line 626 of file debug.c. References hex2mem, make_return_packet, and MAY_FAULT. |
|
P - write one register.
Definition at line 784 of file debug.c. References make_return_packet. |
|
G - write registers.
|
|
Scan for the sequence $<data>#<checksum>.
Definition at line 323 of file debug.c. References _LIBC_inbyte, _LIBC_outbyte, BUFMAX, and hex2digit. |
|
converts an ascii hex digit to a number.
Definition at line 188 of file debug.c. References ERROR. |
|
while we find nice hex chars, build an int.
Definition at line 299 of file debug.c. References hex2digit. |
|
Convert the hex array pointed to by buf into binary to be placed in mem.
Definition at line 269 of file debug.c. References DEBUG, hex2digit, and set_mem_fault_trap. |
|
make a return packet.
Definition at line 559 of file debug.c. References digit2hex, and packet_out_buf. |
|
converts a memory block to hex and stores it in buf.
Definition at line 231 of file debug.c. References DEBUG, digit2hex, MAY_FAULT, and set_mem_fault_trap. |
|
Send the packet in buffer.
Definition at line 387 of file debug.c. References _LIBC_inbyte, _LIBC_outbyte, and digit2hex. |
|
this is a memory fault exception handler, used by mem2hex & hex2mem |
|
this is a list of signal to exception mappings. |
|
indicate whether the debug vectors ahave been initialized 0 means not yet, 1 means yep, it's ready. Definition at line 93 of file debug.c. Referenced by set_debug_traps. |
|
indicate to caller of mem2hex or hex2mem that there has been an error. 0 means ok, 1 means error |
|
1 means print debugging messages from the target, 0 means be quiet. This is changed by gdb_debug(). Definition at line 85 of file debug.c. Referenced by debuglog, gdb_debug, and gdb_toggle. |