Barrelfish
|
Architecture-independent parts of in-kernel GDB stub. More...
Macros | |
#define | DEBUG_ENABLED true |
Flag. Enables debug messages from the stub itself. | |
#define | DEBUG(...) |
Quick-and-dirty debug message macro. | |
#define | BUFMAX 512 |
Defines the maximum number of characters in in/outbound buffers. More... | |
Functions | |
void | gdb_stub_entry (int signal_code, char *OPT NTS init_message) |
Generic entry point to the GDB stub. More... | |
Architecture-independent parts of in-kernel GDB stub.
This file implements the kernel-side GDB stubs for remote debugging when running on hardware. It is loosely based on the public domain i386-stub.c which is part of the GDB sources.
The following gdb commands are supported:
command | function | Return value |
? | What was the last sigval ? | SNN (signal NN) |
g | return the value of the CPU registers | hex data or ENN |
G | set the value of the CPU registers | OK or ENN |
p | read the value of a single CPU register | hex data or ENN |
P | set the value of a single CPU register | OK or ENN |
mAA..AA,LLLL | Read LLLL bytes at address AA..AA | hex data or ENN |
MAA..AA,LLLL: | Write LLLL bytes at address AA.AA | OK or ENN |
c | Resume at current address | SNN (signal NN) |
cAA..AA | Continue at address AA..AA | SNN |
s | Step one instruction | SNN |
sAA..AA | Step one instruction from AA..AA | SNN |
D | GDB detached – attempt to resume | (no reply) |
k | kill – reboots the system | (no reply) |
All commands and responses are sent with a packet which includes a checksum. A packet consists of $<packet info>#<checksum> where:
When a packet is received, it is first acknowledged with either '+' or '-'. '+' indicates a successful transfer. '-' indicates a failed transfer.
Example:
#define BUFMAX 512 |
Defines the maximum number of characters in in/outbound buffers.
At least NUMREGBYTES * 2 are needed for register packets.
void gdb_stub_entry | ( | int | signal_code, |
char *OPT NTS | init_message | ||
) |
Generic entry point to the GDB stub.
Wait for a remote GDB to start talking to us, and then service its requests. This function should run on a different stack the main kernel, and does not return.
signal_code | Unix-style signal value indicating reason for interruption |
init_message | Optional initial message to send to the remote GDB |