2012-11-14 Daniel Jacobowitz <dan@codesourcery.com>
Yao Qi <yao@codesourcery.com>
* arm-tdep.c (arm_addr_bits_remove): Do not adjust the low
bit of EXC_RETURN.
(arm_m_exception_cache, arm_m_exception_this_id)
(arm_m_exception_prev_register, arm_m_exception_unwind_sniffer)
(arm_m_exception_unwind): New.
(arm_gdbarch_init): Register arm_m_exception_unwind.
* breakpoint.h (bp_location): Add related_address member.
* inferior.h (get_return_value): Take a pointer to struct value
instead of struct type for the function requested.
* value.h (using_struct_return): Likewise.
* gdbarch.sh (return_value): Take a pointer to struct value
instead of struct type for the function requested.
* breakpoint.c (set_breakpoint_location_function): Initialize
related_address for bp_gnu_ifunc_resolver breakpoints.
* elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the
requested function's address to gdbarch_return_value.
* eval.c (evaluate_subexp_standard): Pass the requested
function's address to using_struct_return.
* infcall.c (call_function_by_hand): Pass the requested
function's address to using_struct_return and
gdbarch_return_value.
* infcmd.c (get_return_value): Take a pointer to struct value
instead of struct type for the function requested.
(print_return_value): Update accordingly.
(finish_command_continuation): Likewise.
* stack.c (return_command): Pass the requested function's
address to using_struct_return and gdbarch_return_value.
* value.c (using_struct_return): Take a pointer to struct value
instead of struct type for the function requested. Pass the
requested function's address to gdbarch_return_value.
* python/py-finishbreakpoint.c (finish_breakpoint_object):
New function_value member, replacing function_type.
(bpfinishpy_dealloc): Update accordingly.
(bpfinishpy_pre_stop_hook): Likewise.
(bpfinishpy_init): Likewise. Record the requested function's
address.
* mips-tdep.c (mips_fval_reg): New enum.
(mips_o32_push_dummy_call): For MIPS16 FP doubles do not swap
words put in GP registers.
(mips_o64_push_dummy_call): Update a comment.
(mips_o32_return_value): Take a pointer to struct value instead
of struct type for the function requested and use it to check if
using the MIPS16 calling convention. Return the designated
general purpose registers for floating-point values returned in
MIPS16 mode.
(mips_o64_return_value): Likewise.
* ppc-tdep.h (ppc_sysv_abi_return_value): Update prototype.
(ppc_sysv_abi_broken_return_value): Likewise.
(ppc64_sysv_abi_return_value): Likewise.
* alpha-tdep.c (alpha_return_value): Take a pointer to struct
value instead of struct type for the function requested.
* amd64-tdep.c (amd64_return_value): Likewise.
* amd64-windows-tdep.c (amd64_windows_return_value): Likewise.
* arm-tdep.c (arm_return_value): Likewise.
* avr-tdep.c (avr_return_value): Likewise.
* bfin-tdep.c (bfin_return_value): Likewise.
* cris-tdep.c (cris_return_value): Likewise.
* frv-tdep.c (frv_return_value): Likewise.
* h8300-tdep.c (h8300_return_value): Likewise.
(h8300h_return_value): Likewise.
* hppa-tdep.c (hppa32_return_value): Likewise.
(hppa64_return_value): Likewise.
* i386-tdep.c (i386_return_value): Likewise.
* ia64-tdep.c (ia64_return_value): Likewise.
* iq2000-tdep.c (iq2000_return_value): Likewise.
* lm32-tdep.c (lm32_return_value): Likewise.
* m32c-tdep.c (m32c_return_value): Likewise.
* m32r-tdep.c (m32r_return_value): Likewise.
* m68hc11-tdep.c (m68hc11_return_value): Likewise.
* m68k-tdep.c (m68k_return_value): Likewise.
(m68k_svr4_return_value): Likewise.
* m88k-tdep.c (m88k_return_value): Likewise.
* mep-tdep.c (mep_return_value): Likewise.
* microblaze-tdep.c (microblaze_return_value): Likewise.
* mn10300-tdep.c (mn10300_return_value): Likewise.
* moxie-tdep.c (moxie_return_value): Likewise.
* mt-tdep.c (mt_return_value): Likewise.
* ppc-linux-tdep.c (ppc_linux_return_value): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Likewise.
(ppc_sysv_abi_broken_return_value): Likewise.
(ppc64_sysv_abi_return_value): Likewise.
* ppcnbsd-tdep.c (ppcnbsd_return_value): Likewise.
* rl78-tdep.c (rl78_return_value): Likewise.
* rs6000-aix-tdep.c (rs6000_return_value): Likewise.
* rx-tdep.c (rx_return_value): Likewise.
* s390-tdep.c (s390_return_value): Likewise.
* score-tdep.c (score_return_value): Likewise.
* sh-tdep.c (sh_return_value_nofpu): Likewise.
(sh_return_value_fpu): Likewise.
* sh64-tdep.c (sh64_return_value): Likewise.
* sparc-tdep.c (sparc32_return_value): Likewise.
* sparc64-tdep.c (sparc64_return_value): Likewise.
* spu-tdep.c (spu_return_value): Likewise.
* tic6x-tdep.c (tic6x_return_value): Likewise.
* v850-tdep.c (v850_return_value): Likewise.
* vax-tdep.c (vax_return_value): Likewise.
* xstormy16-tdep.c (xstormy16_return_value): Likewise.
* xtensa-tdep.c (xtensa_return_value): Likewise.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
gdb/testsuite/
* gdb.base/return-nodebug.exp: Also test float and double types.
set_gdbarch_process_record.
Initialize `arm_swi_record' field.
* arm-tdep.c (arm_process_record): New function.
(deallocate_reg_mem): New function.
(decode_insn): New function.
(thumb_record_branch): New function.
(thumb_record_ldm_stm_swi(): New function.
(thumb_record_misc): New function.
(thumb_record_ld_st_stack): New function.
(thumb_record_ld_st_imm_offset): New function.
(thumb_record_ld_st_reg_offset(): New function.
(thumb_record_add_sub_cmp_mov): New function.
(thumb_record_shift_add_sub): New function.
(arm_record_coproc_data_proc): New function.
(arm_record_coproc): New function.
(arm_record_b_bl): New function.
(arm_record_ld_st_multiple): New function.
(arm_record_ld_st_reg_offset): New function.
(arm_record_ld_st_imm_offset): New function.
(arm_record_data_proc_imm): New function.
(arm_record_data_proc_misc_ld_str): New function.
(arm_record_extension_space): New function.
(arm_record_strx): New function.
(sbo_sbz): New function.
(struct insn_decode_record): New structure for arm insn record.
(REG_ALLOC): New macro for reg allocations.
(MEM_ALLOC): New macro for memory allocations.
* arm-tdep.h (struct gdbarch_tdep): New field 'arm_swi_record'
(arm_register_g_packet_guesses): New function.
(arm_gdbarch_init): Don't force a target description with
registers when the executable is detected as M-profile. Instead
set gdbarch->tdep->is_m. Register `g' packet guesses.
(_initialize_arm_tdep): Initialize the new target description.
* features/arm-with-m-fpa-layout.xml: New description.
* features/arm-with-m-fpa-layout.c: New, generated.
* arm-tdep.c (thumb_analyze_prologue): Always fallback on the SP
register when the frame can't be determined.
* arm-tdep.c (arm_analyze_prologue): Ditto.
gdb/testsuite/
* gdb.arch/thumb-prologue.c (switch_stack_to_same): New test function.
(switch_stack_to_other): New test function.
* gdb.arch/thumb-prologue.exp: New test cases.
* solib-svr4.c (open_symbol_file_object): Call do_cleanups on all
return paths. Defer final do_cleanups until last return.
* arm-tdep.c (arm_exidx_new_objfile): Make null cleanup after
early return.
* frame.c (frame_unwind_register): Throw an error if unwinding the
register failed.
* get_prev_frame_1 (get_prev_frame_1): Ask the unwinder if there's
an unwind stop reason.
(frame_stop_reason_string): Handle UNWIND_UNAVAILABLE.
* frame.h (enum unwind_stop_reason) <UNWIND_OUTERMOST,
UNWIND_UNAVAILABLE>: New.
* inline-frame.c (inline_frame_unwind): Install
default_frame_unwind_stop_reason.
* frame-unwind.c: Include "exceptions.h".
(frame_unwind_find_by_frame): Swallow NOT_AVAILABLE_ERROR errors.
(default_frame_unwind_stop_reason): New.
* frame-unwind.h (frame_unwind_stop_reason_ftype): New typedef.
(default_frame_unwind_stop_reason): Declare.
(struct frame_unwind) <stop_reason>: New function pointer.
* dummy-frame.c: Install default_frame_unwind_stop_reason.
* dwarf2-frame.c: Include exceptions.h.
(struct dwarf2_frame_cache) <unavailable_retaddr>: New field.
(dwarf2_frame_cache): Swallow NOT_AVAILABLE_ERROR errors when
computing the CFA. If such an error was thrown, set
unavailable_retaddr.
(dwarf2_frame_unwind_stop_reason): New.
(dwarf2_frame_this_id): Don't build a frame id if the CFA was
unavailable.
(dwarf2_frame_unwind): Install dwarf2_frame_unwind_stop_reason.
(dwarf2_signal_frame_unwind): Ditto.
* amd64-tdep.c: Include "exceptions.h".
(struct amd64_frame_cache): New field "base_p".
(amd64_init_frame_cache): Clear it.
(amd64_frame_cache_1): New, factored out from amd64_frame_cache.
Avoid reading registers with functions that throw if the register
is not necessary to compute the frame base.
(amd64_frame_cache): Reimplement wrapping amd64_frame_cache_1, and
swallowing NOT_AVAILABLE_ERROR.
(amd64_frame_unwind_stop_reason): New.
(amd64_frame_this_id): Don't build a frame id if the frame base
was unavailable.
(amd64_frame_unwind): Install amd64_frame_unwind_stop_reason.
(amd64_sigtramp_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set
base_p if the frame base was computable.
(amd64_sigtramp_frame_unwind_stop_reason): New.
(amd64_sigtramp_frame_this_id): Don't build a frame id if the
frame base was unavailable.
(amd64_sigtramp_frame_unwind): Install
amd64_sigtramp_frame_unwind_stop_reason.
(amd64_epilogue_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set
base_p if the frame base was computable.
(amd64_epilogue_frame_unwind_stop_reason): New.
(amd64_epilogue_frame_this_id): Don't build a frame id if the
frame base was unavailable.
(amd64_epilogue_frame_unwind): Install
amd64_epilogue_frame_unwind_stop_reason.
* i386-tdep.c: Include "exceptions.h".
(struct i386_frame_cache): New field "base_p".
(i386_init_frame_cache): Clear it.
(i386_frame_cache_1): New, factored out from amd64_frame_cache.
Avoid reading registers with functions that throw if the register
is not necessary to compute the frame base.
(i386_frame_cache): Reimplement wrapping amd64_frame_cache_1, and
swallowing NOT_AVAILABLE_ERROR.
(i386_frame_unwind_stop_reason): New.
(i386_frame_this_id): Don't build a frame id if the frame base was
unavailable.
(i386_frame_prev_register): Handle unavailable SP.
(i386_frame_unwind): Install i386_frame_unwind_stop_reason.
(i386_epilogue_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set
base_p if the frame base was computable.
(i386_epilogue_frame_unwind_stop_reason): New.
(i386_epilogue_frame_this_id): Don't build a frame id if the frame
base was unavailable.
(i386_epilogue_frame_unwind): Install
i386_epilogue_frame_unwind_stop_reason.
(i386_sigtramp_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set
base_p if the frame base was computable.
(i386_sigtramp_frame_unwind_stop_reason): New.
(i386_sigtramp_frame_this_id): Don't build a frame id if the frame
base was unavailable.
(i386_sigtramp_frame_unwind): Install
i386_sigtramp_frame_unwind_stop_reason.
* sentinel-frame.c (sentinel_frame_prev_register): Use the value
type's size, not the register's.
(sentinel_frame_unwind): Install default_frame_unwind_stop_reason.
* alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind): Install
default_frame_unwind_stop_reason.
* alpha-tdep.c (alpha_sigtramp_frame_unwind)
(alpha_heuristic_frame_unwind): Ditto.
* amd64obsd-tdep.c (amd64obsd_trapframe_unwind): Ditto.
* arm-tdep.c (arm_prologue_unwind, arm_stub_unwind): Ditto.
* avr-tdep.c (avr_frame_unwind): Ditto.
* cris-tdep.c (cris_sigtramp_frame_unwind, cris_frame_unwind):
Ditto.
* frv-linux-tdep.c (frv_linux_sigtramp_frame_unwind): Ditto.
* frv-tdep.c (frv_frame_unwind): Ditto.
* h8300-tdep.c (h8300_frame_unwind): Ditto.
* hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind): Ditto.
* hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind): Ditto.
* hppa-tdep.c (hppa_frame_unwind, hppa_fallback_frame_unwind)
(hppa_stub_frame_unwind): Ditto.
* i386obsd-tdep.c (i386obsd_trapframe_unwind): Ditto.
* ia64-tdep.c (ia64_frame_unwind, ia64_sigtramp_frame_unwind)
(ia64_libunwind_frame_unwind)
(ia64_libunwind_sigtramp_frame_unwind): Ditto.
* iq2000-tdep.c (iq2000_frame_unwind): Ditto.
* lm32-tdep.c (lm32_frame_unwind): Ditto.
* m32c-tdep.c (m32c_unwind): Ditto.
* m32r-linux-tdep.c (m32r_linux_sigtramp_frame_unwind): Ditto.
* m32r-tdep.c (m32r_frame_unwind): Ditto.
* m68hc11-tdep.c (m68hc11_frame_unwind): Ditto.
* m68k-tdep.c (m68k_frame_unwind): Ditto.
* m68klinux-tdep.c (m68k_linux_sigtramp_frame_unwind): Ditto.
* m88k-tdep.c (m88k_frame_unwind): Ditto.
* mep-tdep.c (mep_frame_unwind): Ditto.
* microblaze-tdep.c (microblaze_frame_unwind): Ditto.
* mips-tdep.c (mips_insn16_frame_unwind, mips_insn32_frame_unwind)
(mips_stub_frame_unwind): Ditto.
* mn10300-tdep.c (mn10300_frame_unwind): Ditto.
* moxie-tdep.c (moxie_frame_unwind): Ditto.
* mt-tdep.c (mt_frame_unwind): Ditto.
* ppc-linux-tdep.c (ppu2spu_unwind): Ditto.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_unwind): Ditto.
* rs6000-tdep.c (rs6000_frame_unwind): Ditto.
* s390-tdep.c (s390_frame_unwind, s390_stub_frame_unwind)
(s390_sigtramp_frame_unwind): Ditto.
* score-tdep.c (score_prologue_unwind): Ditto.
* sh-tdep.c (sh_frame_unwind): Ditto.
* sh64-tdep.c (sh64_frame_unwind): Ditto.
* sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_unwind): Ditto.
* sparc-tdep.c (sparc32_frame_unwind): Ditto.
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_unwind): Ditto.
* sparc64-tdep.c (sparc64_frame_unwind): Ditto.
* sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_unwind): Ditto.
* sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_unwind): Ditto.
* sparc64obsd-tdep.c (sparc64obsd_frame_unwind)
(sparc64obsd_trapframe_unwind): Ditto.
* sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_unwind): Ditto.
* sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_unwind): Ditto.
* spu-tdep.c (spu_frame_unwind, spu2ppu_unwind): Ditto.
* v850-tdep.c (v850_frame_unwind): Ditto.
* vax-tdep.c (vax_frame_unwind): Ditto.
* vaxobsd-tdep.c (vaxobsd_sigtramp_frame_unwind): Ditto.
* xstormy16-tdep.c (frame_unwind xstormy16_frame_unwind): Ditto.
* xtensa-tdep.c (xtensa_unwind): Ditto.
* regcache.h (regcache_raw_read, regcache_raw_read_signed)
(regcache_raw_read_unsigned, regcache_raw_read_signed)
(regcache_raw_read_unsigned, regcache_raw_read_part)
(regcache_cooked_read, regcache_cooked_read_signed)
(regcache_cooked_read_unsigned, regcache_cooked_read_part)
(regcache_cooked_read_ftype): Change return to enum
register_status.
* regcache.c: Include exceptions.h
(regcache_save): Adjust to handle REG_UNAVAILABLE registers.
(do_cooked_read): Change return to enum register_status. Always
forward to regcache_cooked_read.
(regcache_raw_read): Change return to enum register_status. If
the register is not REG_VALID, memset the buffer. Return the
register's status.
(regcache_raw_read_signed): Handle non-REG_VALID registers and
return the register's status.
(regcache_raw_read_unsigned): Ditto.
(regcache_cooked_read): Change return to enum register_status.
Assert that with read-only regcaches, the register's status must
be known. If the regcache is read-only, and the register is not
REG_VALID, memset the buffer. Return the register's status.
(regcache_cooked_read_signed): Change return to enum
register_status. Handle non-REG_VALID registers and return the
register's status.
(regcache_cooked_read_unsigned): Change return to enum
register_status. Handle non-REG_VALID registers and return the
register's status.
(regcache_xfer_part, regcache_raw_read_part)
(regcache_cooked_read_part): Change return to enum
register_status. Return the register's status.
(regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is
unavailable.
(regcache_dump): Handle unavailable cooked registers.
* frame.c (do_frame_register_read): Adjust interface to match
regcache_cooked_read_ftype.
* gdbarch.sh (pseudo_register_read): Change return to enum
register_status.
* gdbarch.h, gdbarch.c: Regenerate.
* i386-tdep.h (i386_pseudo_register_read): Change return to enum
register_status.
* i386-tdep.c (i386_pseudo_register_read): Change return to enum
register_status. If reading a raw register indicates the raw
register is not valid, return the raw register's status,
otherwise, return REG_VALID.
* amd64-tdep.c (amd64_pseudo_register_read): Change return to enum
register_status. Handle non-REG_VALID raw registers and return
the register's status.
* arm-tdep.c (arm_neon_quad_read)
(arm_pseudo_read): Change return to enum register_status. Handle
non-REG_VALID raw registers and return the register's status.
* avr-tdep.c (avr_pseudo_register_read): Ditto.
* frv-tdep.c (frv_pseudo_register_read): Ditto.
* h8300-tdep.c (h8300_pseudo_register_read): Ditto.
* hppa-tdep.c (hppa_pseudo_register_read): Ditto.
* m32c-tdep.c (m32c_move_reg_t): Change return to enum
register_status.
(m32c_raw_read, m32c_raw_write, m32c_banked_read)
(m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read)
(m32c_part_write, m32c_cat_read, m32c_cat_write)
(m32c_r3r2r1r0_read, m32c_r3r2r1r0_write)
(m32c_pseudo_register_read): Change return to enum
register_status. Adjust.
* m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to
enum register_status. Return the register's status.
* mep-tdep.c (mep_pseudo_cr32_read): Change return to enum
register_status. Return the register's status.
(mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto.
* mips-tdep.c (mips_pseudo_register_read): Ditto.
* mt-tdep.c (mt_pseudo_register_read): Ditto.
* rs6000-tdep.c (move_ev_register_func): New typedef.
(e500_move_ev_register): Use it. Change return to enum
register_status. Return the register's status.
(do_regcache_raw_read): New function.
(do_regcache_raw_write): New function.
(e500_pseudo_register_read): Change return to enum
register_status. Return the register's status. Use
do_regcache_raw_read.
(e500_pseudo_register_write): Adjust. Use do_regcache_raw_write.
(dfp_pseudo_register_read): Change return to enum register_status.
Return the register's status.
(vsx_pseudo_register_read): Ditto.
(efpr_pseudo_register_read): Ditto.
(rs6000_pseudo_register_read): Ditto.
* s390-tdep.c (s390_pseudo_register_read): Change return to enum
register_status. Return the register's status.
* sh64-tdep.c (pseudo_register_read_portions): New function.
(sh64_pseudo_register_read): Change return to enum
register_status. Use pseudo_register_read_portions. Return the
register's status.
* ia64-tdep.c (ia64_pseudo_register_read): Change return to enum
register_status. Return the register's status.
* sh-tdep.c (pseudo_register_read_portions): New function.
(sh_pseudo_register_read): Change return to enum register_status.
Use pseudo_register_read_portions. Return the register's status.
* sparc-tdep.c (sparc32_pseudo_register_read): Change return to
enum register_status. Return the register's status.
* sparc64-tdep.c (sparc64_pseudo_register_read): Ditto.
* spu-tdep.c (spu_pseudo_register_read_spu)
(spu_pseudo_register_read): Ditto.
* xtensa-tdep.c (xtensa_register_read_masked)
(xtensa_pseudo_register_read): Ditto.
* bfin-tdep.c (bfin_pseudo_register_read): Ditto.
* arm-tdep.h (struct displaced_step_closure): Add two new fields
is_thumb and insn_size.
* arm-tdep.c (displaced_read_reg): Adjust correct pipeline offset
on both ARM and Thumb mode.
(arm_process_displaced_insn): Set is_thumb and insn_size.
(arm_displaced_init_closure): Handle both 16-bit and 32-bit.
(arm_displaced_step_fixup): Likewise.
(arm_linux_restart_syscall_init): Handle both on-stack and in-kernel
versions of the trampoline. Handle Thumb vs. ARM addresses.
(arm_kernel_linux_restart_syscall_tramp_frame): New global.
(arm_linux_init_abi): Install it.
* arm-tdep.c (arm_psr_thumb_bit): Make global.
* arm-tdep.c (arm_psr_thumb_bit): Add prototype.
PR tdep/12352
* arm-tdep.c (copy_ldr_str_ldrb_strb): Replace PC with SP in
order to store PC value on stack instead of text section.
2011-02-15 Yao Qi <yao@codesourcery.com>
PR tdep/12352
* gdb.arch/arm-disp-step.S : New test for str instruction.
* gdb.arch/arm-disp-step.exp : Likewise
arguments. Skip in-prologue calls to glibc __aeabi_read_tp
implementation even if no symbols are available.
(thumb_analyze_prologue): Update call to skip_prologue_function.
(arm_analyze_prologue): Likewise.
(arm_prologue_this_id): Use frame PC if get_frame_func returns 0.
(arm_exidx_data_key): New static variable.
(struct arm_exidx_entry, arm_exidx_entry_s): New data types.
(struct arm_exidx_data): Likewise.
(arm_exidx_data_free): New function.
(arm_compare_exidx_entries): Likewise.
(arm_obj_section_from_vma): Likewise.
(arm_exidx_new_objfile): Likewise.
(arm_find_exidx_entry): Likewise.
(arm_exidx_fill_cache): Likewise.
(arm_exidx_unwind_sniffer): Likewise.
(arm_exidx_unwind): New global variable.
(arm_gdbarch_init): Append unwinder arm_exidx_unwind.
(_initialize_arm_tdep): Attach arm_exidx_new_objfile to new_objfile
observer. Register arm_exidx_data_key as objfile data.