StuBS
|
Structure for the core state after a trap. More...
#include <debug/gdb/state.h>
Classes | |
struct | Register |
Structure to access a register. More... | |
struct | Registers |
Public Types | |
enum | RegisterNumber { REG_RAX , REG_RBX , REG_RCX , REG_RDX , REG_RSI , REG_RDI , REG_RBP , REG_RSP , REG_8 , REG_9 , REG_10 , REG_11 , REG_12 , REG_13 , REG_14 , REG_15 , REG_RIP , REG_EFLAGS , REG_CS , REG_SS , REG_DS , REG_ES , REG_FS , REG_GS , REG_ST0 , REG_ST1 , REG_ST2 , REG_ST3 , REG_ST4 , REG_ST5 , REG_ST6 , REG_ST7 , REG_FCTRL , REG_FSTAT , REG_FTAG , REG_FISEG , REG_FIOFF , REG_FOSEG , REG_FOOFF , REG_FOP , REG_XMM0 , REG_XMM1 , REG_XMM2 , REG_XMM3 , REG_XMM4 , REG_XMM5 , REG_XMM6 , REG_XMM7 , REG_XMM8 , REG_XMM9 , REG_XMM10 , REG_XMM11 , REG_XMM12 , REG_XMM13 , REG_XMM14 , REG_XMM15 , REG_MXCSR , REGISTERS } |
Static Public Member Functions | |
static Register | get (enum RegisterNumber reg=REGISTERS, int8_t core=0) |
Access a previously saved register. | |
static Register | get (uintptr_t reg, int8_t core=0) |
Access a previously saved register. | |
static void | save (const DebugContext *context) |
Read register content from DebugContext and FPU. | |
static void | restore (DebugContext *context) |
Write register contents back DebugContext and FPU. | |
Private Types | |
enum | Offset { OFFSET_GENERAL , OFFSET_SEGMENT = REG_EFLAGS , OFFSET_FPU_DATA = REG_ST0 , OFFSET_FPU_STATUS = REG_FCTRL , OFFSET_XMM_DATA = REG_XMM0 , OFFSET_XMM_STATUS = REG_MXCSR } |
enum | Size { SIZE_GENERAL = OFFSET_SEGMENT - OFFSET_GENERAL , SIZE_SEGMENT = OFFSET_FPU_DATA - OFFSET_SEGMENT , SIZE_FPU_DATA = OFFSET_FPU_STATUS - OFFSET_FPU_DATA , SIZE_FPU_STATUS = OFFSET_XMM_DATA - OFFSET_FPU_STATUS , SIZE_XMM_DATA = OFFSET_XMM_STATUS - OFFSET_XMM_DATA , SIZE_XMM_STATUS = REGISTERS - OFFSET_XMM_STATUS } |
Private Member Functions | |
assert_size (Registers, 536) | |
Private Attributes | |
Registers | registers |
Structure for the core state after a trap.
GDB allows both reading and changing of registers. These registers are saved at the entry function of a trap (before the actual GDB_Stub::handle is executed) and then converted into this structure – and usually also directly transferred to the connected GDB host. Changes done by the GDB host are first saved in this structure and then written back into the registers right before continuing the actual operating system code.
struct State::Registers |
Class Members | ||
---|---|---|
uintptr_t | general[SIZE_GENERAL] | |
uint32_t | segment[SIZE_SEGMENT] | |
struct ST | fpu_data[SIZE_FPU_DATA] | |
uint32_t | fpu_status[SIZE_FPU_STATUS] | |
struct XMM | xmm_data[SIZE_XMM_DATA] | |
uint32_t | xmm_status[SIZE_XMM_STATUS] |
|
private |
|
private |
|
private |
|
static |
Access a previously saved register.
reg | Register identifier. If State::REGISTERS is used, all registers will be returned |
core | 1-indexed Core ID (≤ 0 for current core) |
|
static |
Access a previously saved register.
reg | Register identifier. If State::REGISTERS is used, all registers will be returned |
core | 1-indexed Core ID (≤ 0 for current core) |
|
static |
Read register content from DebugContext and FPU.
context | Pointer to context of gdb_interrupt_handler |
|
static |
Write register contents back DebugContext and FPU.
context | Pointer to context of gdb_interrupt_handler, which will finally be restored after returning from the handler. |
|
private |