Barrelfish
Functions | Variables
gdb_arch.c File Reference

x86-specific parts of in-kernel GDB stub. More...

Functions

void gdb_handle_exception_onstack (int vector, uintptr_t *NONNULL COUNT(GDB_X86_64_NUM_REGS) save_area)
 Entry point for an exception; we are now on our own stack. More...
 
int gdb_arch_get_register (int regnum, uintptr_t *value)
 Get the value of a single register in the frame. More...
 
int gdb_arch_set_register (int regnum, uintptr_t value)
 Set the value of a single register in the frame. More...
 
void gdb_resume (void)
 Resume execution. More...
 
void gdb_arch_continue (lvaddr_t addr)
 Resume program execution. More...
 
void gdb_arch_single_step (lvaddr_t addr)
 Single-step program execution. More...
 
int gdb_arch_write_byte (uint8_t *addr, uint8_t val)
 Writes a byte to an arbitrary address in kernel memory. More...
 
int gdb_arch_read_byte (uint8_t *addr, uint8_t *val)
 Reads a byte from an arbitrary address in kernel memory. More...
 

Variables

uintptr_t * gdb_arch_registers
 GDB register save area / frame. More...
 
uintptr_t *SNT gdb_stack_top = &gdb_stack[KERNEL_STACK_SIZE/sizeof(uintptr_t)]
 Pointer to top of GDB stack area.
 

Detailed Description

x86-specific parts of in-kernel GDB stub.

This file implements x86 architecture support for the kernel-side GDB stubs.

Function Documentation

void gdb_arch_continue ( lvaddr_t  addr)

Resume program execution.

Parameters
addrAddress to resume at, or 0 to continue at last address.
int gdb_arch_get_register ( int  regnum,
uintptr_t *  value 
)

Get the value of a single register in the frame.

Parameters
regnumregister number (as defined by the #gdb_register_nums enum)
valuepointer to location in which to return current value
Returns
Zero on success, nonzero on failure (invalid regnum).
int gdb_arch_read_byte ( uint8_t *  addr,
uint8_t *  val 
)

Reads a byte from an arbitrary address in kernel memory.

Returns
Zero on success, nonzero on error (invalid address)
int gdb_arch_set_register ( int  regnum,
uintptr_t  value 
)

Set the value of a single register in the frame.

Parameters
regnumregister number (as defined by the #gdb_register_nums enum)
valuenew value
Returns
Zero on success, nonzero on failure (invalid regnum).
void gdb_arch_single_step ( lvaddr_t  addr)

Single-step program execution.

Parameters
addrAddress to resume at, or 0 to continue at last address.
int gdb_arch_write_byte ( uint8_t *  addr,
uint8_t  val 
)

Writes a byte to an arbitrary address in kernel memory.

Returns
Zero on success, nonzero on error (invalid address)
void gdb_handle_exception_onstack ( int  vector,
uintptr_t *NONNULL COUNT(GDB_X86_64_NUM_REGS)  save_area 
)

Entry point for an exception; we are now on our own stack.

This function sets up the GDB-format register save frame, constructs the initial message to the remote GDB and calls into the generic debugger entry point.

void gdb_resume ( void  )

Resume execution.

Resumes execution with the CPU state stored in the gdb_arch_registers frame.

Variable Documentation

uintptr_t* gdb_arch_registers

GDB register save area / frame.

Stores pointer to current save frame used by GDB. Used to read/modify register contents, and reloaded when program execution resumes.