diff options
Diffstat (limited to 'gdb/ppc-fbsd-tdep.c')
-rw-r--r-- | gdb/ppc-fbsd-tdep.c | 157 |
1 files changed, 71 insertions, 86 deletions
diff --git a/gdb/ppc-fbsd-tdep.c b/gdb/ppc-fbsd-tdep.c index 4355b64..91c7815 100644 --- a/gdb/ppc-fbsd-tdep.c +++ b/gdb/ppc-fbsd-tdep.c @@ -37,74 +37,62 @@ #include "solib-svr4.h" #include "inferior.h" - /* 32-bit regset descriptions. */ -static const struct ppc_reg_offsets ppc32_fbsd_reg_offsets = - { - /* General-purpose registers. */ - /* .r0_offset = */ 0, - /* .gpr_size = */ 4, - /* .xr_size = */ 4, - /* .pc_offset = */ 144, - /* .ps_offset = */ -1, - /* .cr_offset = */ 132, - /* .lr_offset = */ 128, - /* .ctr_offset = */ 140, - /* .xer_offset = */ 136, - /* .mq_offset = */ -1, - - /* Floating-point registers. */ - /* .f0_offset = */ 0, - /* .fpscr_offset = */ 256, - /* .fpscr_size = */ 8 - }; +static const struct ppc_reg_offsets ppc32_fbsd_reg_offsets = { + /* General-purpose registers. */ + /* .r0_offset = */ 0, + /* .gpr_size = */ 4, + /* .xr_size = */ 4, + /* .pc_offset = */ 144, + /* .ps_offset = */ -1, + /* .cr_offset = */ 132, + /* .lr_offset = */ 128, + /* .ctr_offset = */ 140, + /* .xer_offset = */ 136, + /* .mq_offset = */ -1, + + /* Floating-point registers. */ + /* .f0_offset = */ 0, + /* .fpscr_offset = */ 256, + /* .fpscr_size = */ 8 +}; /* 64-bit regset descriptions. */ -static const struct ppc_reg_offsets ppc64_fbsd_reg_offsets = - { - /* General-purpose registers. */ - /* .r0_offset = */ 0, - /* .gpr_size = */ 8, - /* .xr_size = */ 8, - /* .pc_offset = */ 288, - /* .ps_offset = */ -1, - /* .cr_offset = */ 264, - /* .lr_offset = */ 256, - /* .ctr_offset = */ 280, - /* .xer_offset = */ 272, - /* .mq_offset = */ -1, - - /* Floating-point registers. */ - /* .f0_offset = */ 0, - /* .fpscr_offset = */ 256, - /* .fpscr_size = */ 8 - }; +static const struct ppc_reg_offsets ppc64_fbsd_reg_offsets = { + /* General-purpose registers. */ + /* .r0_offset = */ 0, + /* .gpr_size = */ 8, + /* .xr_size = */ 8, + /* .pc_offset = */ 288, + /* .ps_offset = */ -1, + /* .cr_offset = */ 264, + /* .lr_offset = */ 256, + /* .ctr_offset = */ 280, + /* .xer_offset = */ 272, + /* .mq_offset = */ -1, + + /* Floating-point registers. */ + /* .f0_offset = */ 0, + /* .fpscr_offset = */ 256, + /* .fpscr_size = */ 8 +}; /* 32-bit general-purpose register set. */ -static const struct regset ppc32_fbsd_gregset = { - &ppc32_fbsd_reg_offsets, - ppc_supply_gregset, - ppc_collect_gregset -}; +static const struct regset ppc32_fbsd_gregset + = { &ppc32_fbsd_reg_offsets, ppc_supply_gregset, ppc_collect_gregset }; /* 64-bit general-purpose register set. */ -static const struct regset ppc64_fbsd_gregset = { - &ppc64_fbsd_reg_offsets, - ppc_supply_gregset, - ppc_collect_gregset -}; +static const struct regset ppc64_fbsd_gregset + = { &ppc64_fbsd_reg_offsets, ppc_supply_gregset, ppc_collect_gregset }; /* 32-/64-bit floating-point register set. */ -static const struct regset ppc32_fbsd_fpregset = { - &ppc32_fbsd_reg_offsets, - ppc_supply_fpregset, - ppc_collect_fpregset -}; +static const struct regset ppc32_fbsd_fpregset + = { &ppc32_fbsd_reg_offsets, ppc_supply_fpregset, ppc_collect_fpregset }; const struct regset * ppc_fbsd_gregset (int wordsize) @@ -141,17 +129,14 @@ static const int ppcfbsd_page_size = 4096; /* Offset for sigreturn(2). */ -static const int ppcfbsd_sigreturn_offset[] = { - 0xc, /* FreeBSD 32-bit */ - -1 -}; +static const int ppcfbsd_sigreturn_offset[] = { 0xc, /* FreeBSD 32-bit */ + -1 }; /* Signal trampolines. */ static int ppcfbsd_sigtramp_frame_sniffer (const struct frame_unwind *self, - frame_info_ptr this_frame, - void **this_cache) + frame_info_ptr this_frame, void **this_cache) { struct gdbarch *gdbarch = get_frame_arch (this_frame); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); @@ -176,7 +161,7 @@ ppcfbsd_sigtramp_frame_sniffer (const struct frame_unwind *self, unsigned long insn; if (!safe_frame_unwind_memory (this_frame, start_pc + *offset, - {buf, sizeof buf})) + { buf, sizeof buf })) continue; /* Check for "li r0,SYS_sigreturn". */ @@ -185,8 +170,8 @@ ppcfbsd_sigtramp_frame_sniffer (const struct frame_unwind *self, continue; /* Check for "sc". */ - insn = extract_unsigned_integer (buf + PPC_INSN_SIZE, - PPC_INSN_SIZE, byte_order); + insn = extract_unsigned_integer (buf + PPC_INSN_SIZE, PPC_INSN_SIZE, + byte_order); if (insn != 0x44000002) continue; @@ -214,7 +199,7 @@ ppcfbsd_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache) func = get_frame_pc (this_frame); func &= ~(ppcfbsd_page_size - 1); - if (!safe_frame_unwind_memory (this_frame, func, {buf, sizeof buf})) + if (!safe_frame_unwind_memory (this_frame, func, { buf, sizeof buf })) return cache; base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch)); @@ -243,11 +228,11 @@ ppcfbsd_sigtramp_frame_cache (frame_info_ptr this_frame, void **this_cache) } static void -ppcfbsd_sigtramp_frame_this_id (frame_info_ptr this_frame, - void **this_cache, struct frame_id *this_id) +ppcfbsd_sigtramp_frame_this_id (frame_info_ptr this_frame, void **this_cache, + struct frame_id *this_id) { - struct trad_frame_cache *cache = - ppcfbsd_sigtramp_frame_cache (this_frame, this_cache); + struct trad_frame_cache *cache + = ppcfbsd_sigtramp_frame_cache (this_frame, this_cache); trad_frame_get_id (cache, this_id); } @@ -256,21 +241,20 @@ static struct value * ppcfbsd_sigtramp_frame_prev_register (frame_info_ptr this_frame, void **this_cache, int regnum) { - struct trad_frame_cache *cache = - ppcfbsd_sigtramp_frame_cache (this_frame, this_cache); + struct trad_frame_cache *cache + = ppcfbsd_sigtramp_frame_cache (this_frame, this_cache); return trad_frame_get_register (cache, this_frame, regnum); } -static const struct frame_unwind ppcfbsd_sigtramp_frame_unwind = { - "ppc freebsd sigtramp", - SIGTRAMP_FRAME, - default_frame_unwind_stop_reason, - ppcfbsd_sigtramp_frame_this_id, - ppcfbsd_sigtramp_frame_prev_register, - NULL, - ppcfbsd_sigtramp_frame_sniffer -}; +static const struct frame_unwind ppcfbsd_sigtramp_frame_unwind + = { "ppc freebsd sigtramp", + SIGTRAMP_FRAME, + default_frame_unwind_stop_reason, + ppcfbsd_sigtramp_frame_this_id, + ppcfbsd_sigtramp_frame_prev_register, + NULL, + ppcfbsd_sigtramp_frame_sniffer }; static enum return_value_convention ppcfbsd_return_value (struct gdbarch *gdbarch, struct value *function, @@ -308,7 +292,7 @@ ppcfbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, ULONGEST tp; if (regcache->cooked_read (tp_regnum, &tp) != REG_VALID) - error (_("Unable to fetch tcb pointer")); + error (_ ("Unable to fetch tcb pointer")); /* tp points to the end of the TCB block. The first member of the TCB is the pointer to the DTV array. */ @@ -333,8 +317,8 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_return_value (gdbarch, ppcfbsd_return_value); set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); - set_solib_svr4_fetch_link_map_offsets (gdbarch, - svr4_ilp32_fetch_link_map_offsets); + set_solib_svr4_fetch_link_map_offsets ( + gdbarch, svr4_ilp32_fetch_link_map_offsets); frame_unwind_append_unwinder (gdbarch, &ppcfbsd_sigtramp_frame_unwind); set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc"); @@ -342,8 +326,8 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) if (tdep->wordsize == 8) { - set_gdbarch_convert_from_func_ptr_addr - (gdbarch, ppc64_convert_from_func_ptr_addr); + set_gdbarch_convert_from_func_ptr_addr ( + gdbarch, ppc64_convert_from_func_ptr_addr); set_gdbarch_elf_make_msymbol_special (gdbarch, ppc64_elf_make_msymbol_special); @@ -353,8 +337,8 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc"); } - set_gdbarch_iterate_over_regset_sections - (gdbarch, ppcfbsd_iterate_over_regset_sections); + set_gdbarch_iterate_over_regset_sections ( + gdbarch, ppcfbsd_iterate_over_regset_sections); set_gdbarch_fetch_tls_load_module_address (gdbarch, svr4_fetch_objfile_link_map); @@ -363,6 +347,7 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) } void _initialize_ppcfbsd_tdep (); + void _initialize_ppcfbsd_tdep () { |