Changeset View
Changeset View
Standalone View
Standalone View
devel/gdb/files/kgdb/riscv-fbsd-kern.c
Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | static const struct regcache_map_entry riscv_fbsd_tfmap[] = | ||||
{ 1, RISCV_PC_REGNUM, 0 }, | { 1, RISCV_PC_REGNUM, 0 }, | ||||
{ 1, RISCV_CSR_SSTATUS_REGNUM, 0 }, | { 1, RISCV_CSR_SSTATUS_REGNUM, 0 }, | ||||
{ 1, RISCV_CSR_STVAL_REGNUM, 0 }, | { 1, RISCV_CSR_STVAL_REGNUM, 0 }, | ||||
{ 1, RISCV_CSR_SCAUSE_REGNUM, 0 }, | { 1, RISCV_CSR_SCAUSE_REGNUM, 0 }, | ||||
{ 0 } | { 0 } | ||||
}; | }; | ||||
static struct trad_frame_cache * | static struct trad_frame_cache * | ||||
riscv_fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache) | riscv_fbsd_trapframe_cache (frame_info_ptr this_frame, void **this_cache) | ||||
{ | { | ||||
struct gdbarch *gdbarch = get_frame_arch (this_frame); | struct gdbarch *gdbarch = get_frame_arch (this_frame); | ||||
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | ||||
struct trad_frame_cache *cache; | struct trad_frame_cache *cache; | ||||
CORE_ADDR func, pc, sp; | CORE_ADDR func, pc, sp; | ||||
const char *name; | const char *name; | ||||
int xlen; | int xlen; | ||||
Show All 23 Lines | else | ||||
/* Construct the frame ID using the function start. */ | /* Construct the frame ID using the function start. */ | ||||
trad_frame_set_id (cache, frame_id_build (sp + 35 * xlen, func)); | trad_frame_set_id (cache, frame_id_build (sp + 35 * xlen, func)); | ||||
} | } | ||||
return cache; | return cache; | ||||
} | } | ||||
static void | static void | ||||
riscv_fbsd_trapframe_this_id (struct frame_info *this_frame, | riscv_fbsd_trapframe_this_id (frame_info_ptr this_frame, | ||||
void **this_cache, struct frame_id *this_id) | void **this_cache, struct frame_id *this_id) | ||||
{ | { | ||||
struct trad_frame_cache *cache = | struct trad_frame_cache *cache = | ||||
riscv_fbsd_trapframe_cache (this_frame, this_cache); | riscv_fbsd_trapframe_cache (this_frame, this_cache); | ||||
trad_frame_get_id (cache, this_id); | trad_frame_get_id (cache, this_id); | ||||
} | } | ||||
static struct value * | static struct value * | ||||
riscv_fbsd_trapframe_prev_register (struct frame_info *this_frame, | riscv_fbsd_trapframe_prev_register (frame_info_ptr this_frame, | ||||
void **this_cache, int regnum) | void **this_cache, int regnum) | ||||
{ | { | ||||
struct trad_frame_cache *cache = | struct trad_frame_cache *cache = | ||||
riscv_fbsd_trapframe_cache (this_frame, this_cache); | riscv_fbsd_trapframe_cache (this_frame, this_cache); | ||||
return trad_frame_get_register (cache, this_frame, regnum); | return trad_frame_get_register (cache, this_frame, regnum); | ||||
} | } | ||||
static int | static int | ||||
riscv_fbsd_trapframe_sniffer (const struct frame_unwind *self, | riscv_fbsd_trapframe_sniffer (const struct frame_unwind *self, | ||||
struct frame_info *this_frame, | frame_info_ptr this_frame, | ||||
void **this_prologue_cache) | void **this_prologue_cache) | ||||
{ | { | ||||
const char *name; | const char *name; | ||||
find_pc_partial_function (get_frame_func (this_frame), &name, NULL, NULL); | find_pc_partial_function (get_frame_func (this_frame), &name, NULL, NULL); | ||||
return (name != NULL | return (name != NULL | ||||
&& ((strcmp (name, "cpu_exception_handler_user") == 0) || | && ((strcmp (name, "cpu_exception_handler_user") == 0) || | ||||
(strcmp (name, "cpu_exception_handler_supervisor") == 0))); | (strcmp (name, "cpu_exception_handler_supervisor") == 0))); | ||||
} | } | ||||
Show All 10 Lines | |||||
/* Implement the 'init_osabi' method of struct gdb_osabi_handler. */ | /* Implement the 'init_osabi' method of struct gdb_osabi_handler. */ | ||||
static void | static void | ||||
riscv_fbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | riscv_fbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | ||||
{ | { | ||||
frame_unwind_prepend_unwinder (gdbarch, &riscv_fbsd_trapframe_unwind); | frame_unwind_prepend_unwinder (gdbarch, &riscv_fbsd_trapframe_unwind); | ||||
set_solib_ops (gdbarch, &kld_so_ops); | set_gdbarch_so_ops (gdbarch, &kld_so_ops); | ||||
set_gdbarch_software_single_step (gdbarch, riscv_software_single_step); | set_gdbarch_software_single_step (gdbarch, riscv_software_single_step); | ||||
fbsd_vmcore_set_supply_pcb (gdbarch, riscv_fbsd_supply_pcb); | fbsd_vmcore_set_supply_pcb (gdbarch, riscv_fbsd_supply_pcb); | ||||
fbsd_vmcore_set_cpu_pcb_addr (gdbarch, kgdb_trgt_stop_pcb); | fbsd_vmcore_set_cpu_pcb_addr (gdbarch, kgdb_trgt_stop_pcb); | ||||
} | } | ||||
void _initialize_riscv_kgdb_tdep (); | void _initialize_riscv_kgdb_tdep (); | ||||
Show All 9 Lines |