* defs.h (extract_signed_integer, extract_unsigned_integer,

extract_long_unsigned_integer, store_signed_integer,
	store_unsigned_integer): Add BYTE_ORDER parameter.
	* findvar.c (extract_signed_integer, extract_unsigned_integer,
	extract_long_unsigned_integer, store_signed_integer,
	store_unsigned_integer): Add BYTE_ORDER parameter.  Use it
	instead of current_gdbarch.

	* gdbcore.h (read_memory_integer, safe_read_memory_integer,
	read_memory_unsigned_integer, write_memory_signed_integer,
	write_memory_unsigned_integer): Add BYTE_ORDER parameter.
	* corefile.c (struct captured_read_memory_integer_arguments): Add
	BYTE_ORDER member.
	(safe_read_memory_integer): Add BYTE_ORDER parameter.  Store it into
	struct captured_read_memory_integer_arguments.
	(do_captured_read_memory_integer): Pass it to read_memory_integer.
	(read_memory_integer): Add BYTE_ORDER parameter.  Pass it to
	extract_signed_integer.
	(read_memory_unsigned_integer): Add BYTE_ORDER parameter.  Pass it to
	extract_unsigned_integer.
	(write_memory_signed_integer): Add BYTE_ORDER parameter.  Pass it
	to store_signed_integer.
	(write_memory_unsigned_integer): Add BYTE_ORDER parameter.  Pass it
	to store_unsigned_integer.

	* target.h (get_target_memory_unsigned): Add BYTE_ORDER parameter.
	* target.c (get_target_memory_unsigned): Add BYTE_ORDER parameter.
	Pass it to extract_unsigned_integer.


	Update calls to extract_signed_integer, extract_unsigned_integer,
	extract_long_unsigned_integer, store_signed_integer,
	store_unsigned_integer, read_memory_integer,
	read_memory_unsigned_integer, safe_read_memory_integer,
	write_memory_signed_integer, write_memory_unsigned_integer, and
	get_target_memory_unsigned to pass byte order:
	* ada-lang.c (ada_value_binop): Update.
	* ada-valprint.c (char_at): Update.
	* alpha-osf1-tdep.c (alpha_osf1_sigcontext_addr): Update.
	* alpha-tdep.c (alpha_lds, alpha_sts, alpha_push_dummy_call,
	alpha_extract_return_value, alpha_read_insn,
	alpha_get_longjmp_target): Update.
	* amd64-linux-tdep.c (amd64_linux_sigcontext_addr): Update.
	* amd64obsd-tdep.c (amd64obsd_supply_uthread,
	amd64obsd_collect_uthread, amd64obsd_trapframe_cache): Update.
	* amd64-tdep.c (amd64_push_dummy_call, amd64_analyze_prologue,
	amd64_frame_cache, amd64_sigtramp_frame_cache, fixup_riprel,
	amd64_displaced_step_fixup): Update.
	* arm-linux-tdep.c (arm_linux_sigreturn_init,
	arm_linux_rt_sigreturn_init, arm_linux_supply_gregset): Update.
	* arm-tdep.c (thumb_analyze_prologue, arm_skip_prologue,
	arm_scan_prologue, arm_push_dummy_call, thumb_get_next_pc,
	arm_get_next_pc, arm_extract_return_value, arm_store_return_value,
	arm_return_value): Update.
	* arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update.
	* auxv.c (default_auxv_parse): Update.
	* avr-tdep.c (avr_address_to_pointer, avr_pointer_to_address,
	avr_scan_prologue, avr_extract_return_value,
	avr_frame_prev_register, avr_push_dummy_call): Update.
	* bsd-uthread.c (bsd_uthread_check_magic, bsd_uthread_lookup_offset,
	bsd_uthread_wait, bsd_uthread_thread_alive,
	bsd_uthread_extra_thread_info): Update.
	* c-lang.c (c_printstr, print_wchar): Update.
	* cp-valprint.c (cp_print_class_member): Update.
	* cris-tdep.c (cris_sigcontext_addr, cris_sigtramp_frame_unwind_cache,
	cris_push_dummy_call, cris_scan_prologue, cris_store_return_value,
	cris_extract_return_value, find_step_target, dip_prefix,
	sixteen_bit_offset_branch_op, none_reg_mode_jump_op,
	move_mem_to_reg_movem_op, get_data_from_address): Update.
	* dwarf2expr.c (dwarf2_read_address, execute_stack_op): Update.
	* dwarf2-frame.c (execute_cfa_program): Update.
	* dwarf2loc.c (find_location_expression): Update.
	* dwarf2read.c (dwarf2_const_value): Update.
	* expprint.c (print_subexp_standard): Update.
	* findvar.c (unsigned_pointer_to_address, signed_pointer_to_address,
	unsigned_address_to_pointer, address_to_signed_pointer,
	read_var_value): Update.
	* frame.c (frame_unwind_register_signed,
	frame_unwind_register_unsigned, get_frame_memory_signed,
	get_frame_memory_unsigned): Update.
	* frame-unwind.c (frame_unwind_got_constant): Update.
	* frv-linux-tdep.c (frv_linux_pc_in_sigtramp,
	frv_linux_sigcontext_reg_addr, frv_linux_sigtramp_frame_cache):
	Update.
	* frv-tdep.c (frv_analyze_prologue, frv_skip_main_prologue,
	frv_extract_return_value, find_func_descr,
	frv_convert_from_func_ptr_addr, frv_push_dummy_call): Update.
	* f-valprint.c (f_val_print): Update.
	* gnu-v3-abi.c (gnuv3_decode_method_ptr, gnuv3_make_method_ptr):
	Update.
	* h8300-tdep.c (h8300_is_argument_spill, h8300_analyze_prologue,
	h8300_push_dummy_call, h8300_extract_return_value,
	h8300h_extract_return_value, h8300_store_return_value,
	h8300h_store_return_value): Update.
	* hppabsd-tdep.c (hppabsd_find_global_pointer): Update.
	* hppa-hpux-nat.c (hppa_hpux_fetch_register, hppa_hpux_store_register):
	Update.
	* hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline,
	hppa64_hpux_in_solib_call_trampoline,
	hppa_hpux_in_solib_return_trampoline, hppa_hpux_skip_trampoline_code,
	hppa_hpux_sigtramp_frame_unwind_cache,
	hppa_hpux_sigtramp_unwind_sniffer, hppa32_hpux_find_global_pointer,
	hppa64_hpux_find_global_pointer, hppa_hpux_search_pattern,
	hppa32_hpux_search_dummy_call_sequence,
	hppa64_hpux_search_dummy_call_sequence, hppa_hpux_supply_save_state,
	hppa_hpux_unwind_adjust_stub): Update.
	* hppa-linux-tdep.c (insns_match_pattern,
	hppa_linux_find_global_pointer): Update.
	* hppa-tdep.c (hppa_in_function_epilogue_p, hppa32_push_dummy_call,
	hppa64_convert_code_addr_to_fptr, hppa64_push_dummy_call,
	skip_prologue_hard_way, hppa_frame_cache, hppa_fallback_frame_cache,
	hppa_pseudo_register_read, hppa_frame_prev_register_helper,
	hppa_match_insns): Update.
	* hpux-thread.c (hpux_thread_fetch_registers): Update.
	* i386-tdep.c (i386bsd_sigcontext_addr): Update.
	* i386-cygwin-tdep.c (core_process_module_section): Update.
	* i386-darwin-nat.c (i386_darwin_sstep_at_sigreturn,
	amd64_darwin_sstep_at_sigreturn): Update.
	* i386-darwin-tdep.c (i386_darwin_sigcontext_addr,
	amd64_darwin_sigcontext_addr): Likewise.
	* i386-linux-nat.c (i386_linux_sigcontext_addr): Update.
	* i386nbsd-tdep.c (i386nbsd_sigtramp_cache_init): Update.
	* i386-nto-tdep.c (i386nto_sigcontext_addr): Update.
	* i386obsd-nat.c (i386obsd_supply_pcb): Update.
	* i386obsd-tdep.c (i386obsd_supply_uthread, i386obsd_collect_uthread,
	i386obsd_trapframe_cache): Update.
	* i386-tdep.c (i386_displaced_step_fixup, i386_follow_jump,
	i386_analyze_frame_setup, i386_analyze_prologue,
	i386_skip_main_prologue, i386_frame_cache, i386_sigtramp_frame_cache,
	i386_get_longjmp_target, i386_push_dummy_call,
	i386_pe_skip_trampoline_code, i386_svr4_sigcontext_addr,
	i386_fetch_pointer_argument): Update.
	* i387-tdep.c (i387_supply_fsave): Update.
	* ia64-linux-tdep.c (ia64_linux_sigcontext_register_address): Update.
	* ia64-tdep.c (ia64_pseudo_register_read, ia64_pseudo_register_write,
	examine_prologue, ia64_frame_cache, ia64_frame_prev_register,
	ia64_sigtramp_frame_cache, ia64_sigtramp_frame_prev_register,
	ia64_access_reg, ia64_access_rse_reg, ia64_libunwind_frame_this_id,
	ia64_libunwind_frame_prev_register,
	ia64_libunwind_sigtramp_frame_this_id,
	ia64_libunwind_sigtramp_frame_prev_register, ia64_find_global_pointer,
	find_extant_func_descr, find_func_descr,
	ia64_convert_from_func_ptr_addr, ia64_push_dummy_call, ia64_dummy_id,
	ia64_unwind_pc): Update.
	* iq2000-tdep.c (iq2000_pointer_to_address, iq2000_address_to_pointer,
	iq2000_scan_prologue, iq2000_extract_return_value,
	iq2000_push_dummy_call): Update.
	* irix5nat.c (fill_gregset): Update.
	* jv-lang.c (evaluate_subexp_java): Update.
	* jv-valprint.c (java_value_print): Update.
	* lm32-tdep.c (lm32_analyze_prologue, lm32_push_dummy_call,
	lm32_extract_return_value, lm32_store_return_value): Update.
	* m32c-tdep.c (m32c_push_dummy_call, m32c_return_value,
	m32c_skip_trampoline_code, m32c_m16c_address_to_pointer,
	m32c_m16c_pointer_to_address): Update.
	* m32r-tdep.c (m32r_store_return_value, decode_prologue,
	m32r_skip_prologue, m32r_push_dummy_call, m32r_extract_return_value):
	Update.
	* m68hc11-tdep.c (m68hc11_pseudo_register_read,
	m68hc11_pseudo_register_write, m68hc11_analyze_instruction,
	m68hc11_push_dummy_call): Update.
	* m68linux-tdep.c (m68k_linux_pc_in_sigtramp,
	m68k_linux_get_sigtramp_info, m68k_linux_sigtramp_frame_cache):
	Update.
	* m68k-tdep.c (m68k_push_dummy_call, m68k_analyze_frame_setup,
	m68k_analyze_register_saves, m68k_analyze_prologue, m68k_frame_cache,
	m68k_get_longjmp_target): Update.
	* m88k-tdep.c (m88k_fetch_instruction): Update.
	* mep-tdep.c (mep_pseudo_cr32_read, mep_pseudo_csr_write,
	mep_pseudo_cr32_write, mep_get_insn, mep_push_dummy_call): Update.
	* mi/mi-main.c (mi_cmd_data_write_memory): Update.
	* mips-linux-tdep.c (mips_linux_get_longjmp_target, supply_32bit_reg,
	mips64_linux_get_longjmp_target, mips64_fill_gregset,
	mips64_fill_fpregset, mips_linux_in_dynsym_stub): Update.
	* mipsnbdsd-tdep.c (mipsnbsd_get_longjmp_target): Update.
	* mips-tdep.c (mips_fetch_instruction, fetch_mips_16,
	mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call,
	mips_o32_push_dummy_call, mips_o64_push_dummy_call,
	mips_single_step_through_delay, mips_skip_pic_trampoline_code,
	mips_integer_to_address): Update.
	* mn10300-tdep.c (mn10300_analyze_prologue, mn10300_push_dummy_call):
	Update.
	* monitor.c (monitor_supply_register, monitor_write_memory,
	monitor_read_memory_single): Update.
	* moxie-tdep.c (moxie_store_return_value, moxie_extract_return_value,
	moxie_analyze_prologue): Update.
	* mt-tdep.c (mt_return_value, mt_skip_prologue, mt_select_coprocessor,
	mt_pseudo_register_read, mt_pseudo_register_write, mt_registers_info,
	mt_push_dummy_call): Update.
	* objc-lang.c (read_objc_method, read_objc_methlist_nmethods,
	read_objc_methlist_method, read_objc_object, read_objc_super,
	read_objc_class, find_implementation_from_class): Update.
	* ppc64-linux-tdep.c (ppc64_desc_entry_point,
	ppc64_linux_convert_from_func_ptr_addr, ppc_linux_sigtramp_cache):
	Update.
	* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_sniffer,
	ppcobsd_sigtramp_frame_cache): Update.
	* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
	do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
	ppc64_sysv_abi_return_value): Update.
	* ppc-linux-nat.c (ppc_linux_auxv_parse): Update.
	* procfs.c (procfs_auxv_parse): Update.
	* p-valprint.c (pascal_val_print): Update.
	* regcache.c (regcache_raw_read_signed, regcache_raw_read_unsigned,
	regcache_raw_write_signed, regcache_raw_write_unsigned,
	regcache_cooked_read_signed, regcache_cooked_read_unsigned,
	regcache_cooked_write_signed, regcache_cooked_write_unsigned): Update.
	* remote-m32r-sdi.c (m32r_fetch_register): Update.
	* remote-mips.c (mips_wait, mips_fetch_registers, mips_xfer_memory):
	Update.
	* rs6000-aix-tdep.c (rs6000_push_dummy_call, rs6000_return_value,
	rs6000_convert_from_func_ptr_addr, branch_dest,
	rs6000_software_single_step): Update.
	* rs6000-tdep.c (rs6000_in_function_epilogue_p,
	ppc_displaced_step_fixup, ppc_deal_with_atomic_sequence,
	bl_to_blrl_insn_p, rs6000_fetch_instruction, skip_prologue,
	rs6000_skip_main_prologue, rs6000_skip_trampoline_code,
	rs6000_frame_cache): Update.
	* s390-tdep.c (s390_pseudo_register_read, s390_pseudo_register_write,
	s390x_pseudo_register_read, s390x_pseudo_register_write, s390_load,
	s390_backchain_frame_unwind_cache, s390_sigtramp_frame_unwind_cache,
	extend_simple_arg, s390_push_dummy_call, s390_return_value): Update.
	* scm-exp.c (scm_lreadr): Update.
	* scm-lang.c (scm_get_field, scm_unpack): Update.
	* scm-valprint.c (scm_val_print): Update.
	* score-tdep.c (score_breakpoint_from_pc, score_push_dummy_call,
	score_fetch_inst): Update.
	* sh64-tdep.c (look_for_args_moves, sh64_skip_prologue_hard_way,
	sh64_analyze_prologue, sh64_push_dummy_call, sh64_extract_return_value,
	sh64_pseudo_register_read, sh64_pseudo_register_write,
	sh64_frame_prev_register): Update:
	* sh-tdep.c (sh_analyze_prologue, sh_push_dummy_call_fpu,
	sh_push_dummy_call_nofpu, sh_extract_return_value_nofpu,
	sh_store_return_value_nofpu, sh_in_function_epilogue_p): Update.
	* solib-darwin.c (darwin_load_image_infos): Update.
	* solib-frv.c (fetch_loadmap, lm_base, frv_current_sos, enable_break2,
	find_canonical_descriptor_in_load_object): Update.
	* solib-irix.c (extract_mips_address, fetch_lm_info, irix_current_sos,
	irix_open_symbol_file_object): Update.
	* solib-som.c (som_solib_create_inferior_hook, link_map_start,
	som_current_sos, som_open_symbol_file_object): Update.
	* solib-sunos.c (SOLIB_EXTRACT_ADDRESS, LM_ADDR, LM_NEXT, LM_NAME):
	Update.
	* solib-svr4.c (read_program_header, scan_dyntag_auxv,
	solib_svr4_r_ldsomap): Update.
	* sparc64-linux-tdep.c (sparc64_linux_step_trap): Update.
	* sparc64obsd-tdep.c (sparc64obsd_supply_uthread,
	sparc64obsd_collect_uthread): Update.
	* sparc64-tdep.c (sparc64_pseudo_register_read,
	sparc64_pseudo_register_write, sparc64_supply_gregset,
	sparc64_collect_gregset): Update.
	* sparc-linux-tdep.c (sparc32_linux_step_trap): Update.
	* sparcobsd-tdep.c (sparc32obsd_supply_uthread,
	sparc32obsd_collect_uthread): Update.
	* sparc-tdep.c (sparc_fetch_wcookie, sparc32_push_dummy_code,
	sparc32_store_arguments, sparc32_return_value, sparc_supply_rwindow,
	sparc_collect_rwindow): Update.
	* spu-linux-nat.c (parse_spufs_run): Update.
	* spu-tdep.c (spu_pseudo_register_read_spu,
	spu_pseudo_register_write_spu, spu_pointer_to_address,
	spu_analyze_prologue, spu_in_function_epilogue_p,
	spu_frame_unwind_cache, spu_push_dummy_call, spu_software_single_step,
	spu_get_longjmp_target, spu_get_overlay_table, spu_overlay_update_osect,
	info_spu_signal_command, info_spu_mailbox_list, info_spu_dma_cmdlist,
	info_spu_dma_command, info_spu_proxydma_command): Update.
	* stack.c (print_frame_nameless_args, frame_info): Update.
	* symfile.c (read_target_long_array, simple_read_overlay_table,
	simple_read_overlay_region_table): Update.
	* target.c (debug_print_register): Update.
	* tramp-frame.c (tramp_frame_start): Update.
	* v850-tdep.c (v850_analyze_prologue, v850_push_dummy_call,
	v850_extract_return_value, v850_store_return_value,
	* valarith.c (value_binop, value_bit_index): Update.
	* valops.c (value_cast): Update.
	* valprint.c (val_print_type_code_int, val_print_string,
	read_string): Update.
	* value.c (unpack_long, unpack_double, unpack_field_as_long,
	modify_field, pack_long): Update.
	* vax-tdep.c (vax_store_arguments, vax_push_dummy_call,
	vax_skip_prologue): Update.
	* xstormy16-tdep.c (xstormy16_push_dummy_call,
	xstormy16_analyze_prologue, xstormy16_in_function_epilogue_p,
	xstormy16_resolve_jmp_table_entry, xstormy16_find_jmp_table_entry,
	xstormy16_pointer_to_address, xstormy16_address_to_pointer): Update.
	* xtensa-tdep.c (extract_call_winsize, xtensa_pseudo_register_read,
	xtensa_pseudo_register_write, xtensa_frame_cache,
	xtensa_push_dummy_call, call0_track_op, call0_frame_cache): Update.


	* dfp.h (decimal_to_string, decimal_from_string, decimal_from_integral,
	decimal_from_floating, decimal_to_doublest, decimal_is_zero): Add
	BYTE_ORDER parameter.
	(decimal_binop): Add BYTE_ORDER_X, BYTE_ORDER_Y, and BYTE_ORDER_RESULT
	parameters.
	(decimal_compare): Add BYTE_ORDER_X and BYTE_ORDER_Y parameters.
	(decimal_convert): Add BYTE_ORDER_FROM and BYTE_ORDER_TO parameters.
	* dfp.c (match_endianness): Add BYTE_ORDER parameter.  Use it
	instead of current_gdbarch.
	(decimal_to_string, decimal_from_integral, decimal_from_floating,
	decimal_to_doublest, decimal_is_zero): Add BYTE_ORDER parameter.
	Pass it to match_endianness.
	(decimal_binop): Add BYTE_ORDER_X, BYTE_ORDER_Y, and BYTE_ORDER_RESULT
	parameters.  Pass them to match_endianness.
	(decimal_compare): Add BYTE_ORDER_X and BYTE_ORDER_Y parameters.
	Pass them to match_endianness.
	(decimal_convert): Add BYTE_ORDER_FROM and BYTE_ORDER_TO parameters.
	Pass them to match_endianness.
	* valarith.c (value_args_as_decimal): Add BYTE_ORDER_X and
	BYTE_ORDER_Y output parameters.
	(value_binop): Update call to value_args_as_decimal.

	Update calls to decimal_to_string, decimal_from_string,
	decimal_from_integral, decimal_from_floating, decimal_to_doublest,
	decimal_is_zero, decimal_binop, decimal_compare and decimal_convert
	to pass/receive byte order:
	* c-exp.y (parse_number): Update.
	* printcmd.c (printf_command): Update.
	* valarith.c (value_args_as_decimal, value_binop, value_logical_not,
	value_equal, value_less): Update.
	* valops.c (value_cast, value_one): Update.
	* valprint.c (print_decimal_floating): Update.
	* value.c (unpack_long, unpack_double): Update.
	* python/python-value.c (valpy_nonzero): Update.


	* ada-valprint.c (char_at): Add BYTE_ORDER parameter.
	(printstr): Update calls to char_at.
	(ada_val_print_array): Likewise.
	* valprint.c (read_string): Add BYTE_ORDER parameter.
	(val_print_string): Update call to read_string.
	* c-lang.c (c_get_string): Likewise.
	* charset.h (target_wide_charset): Add BYTE_ORDER parameter.
	* charset.c (target_wide_charset): Add BYTE_ORDER parameter.
	Use it instead of current_gdbarch.
	* printcmd.c (printf_command): Update calls to target_wide_charset.
	* c-lang.c (charset_for_string_type): Add BYTE_ORDER parameter.
	Pass to target_wide_charset.  Use it instead of current_gdbarch.
	(classify_type): Add BYTE_ORDER parameter.  Pass to
	charset_for_string_type.  Allow NULL encoding pointer.
	(print_wchar): Add BYTE_ORDER parameter.
	(c_emit_char): Update calls to classify_type and print_wchar.
	(c_printchar, c_printstr): Likewise.


	* gdbarch.sh (in_solib_return_trampoline): Convert to type "m".
	* gdbarch.c, gdbarch.h: Regenerate.
	* arch-utils.h (generic_in_solib_return_trampoline): Add GDBARCH
	parameter.
	* arch-utils.c (generic_in_solib_return_trampoline): Likewise.
	* hppa-hpux-tdep.c (hppa_hpux_in_solib_return_trampoline): Likewise.
	* rs6000-tdep.c (rs6000_in_solib_return_trampoline): Likewise.
	(rs6000_skip_trampoline_code): Update call.

	* alpha-tdep.h (struct gdbarch_tdep): Add GDBARCH parameter to
	dynamic_sigtramp_offset and pc_in_sigtramp callbacks.
	(alpha_read_insn): Add GDBARCH parameter.
	* alpha-tdep.c (alpha_lds, alpha_sts): Add GDBARCH parameter.
	(alpha_register_to_value): Pass architecture to alpha_sts.
	(alpha_extract_return_value): Likewise.
	(alpha_value_to_register): Pass architecture to alpha_lds.
	(alpha_store_return_value): Likewise.
	(alpha_read_insn): Add GDBARCH parameter.
	(alpha_skip_prologue): Pass architecture to alpha_read_insn.
	(alpha_heuristic_proc_start): Likewise.
	(alpha_heuristic_frame_unwind_cache): Likewise.
	(alpha_next_pc): Likewise.
	(alpha_sigtramp_frame_this_id): Pass architecture to
	tdep->dynamic_sigtramp_offset callback.
	(alpha_sigtramp_frame_sniffer): Pass architecture to
	tdep->pc_in_sigtramp callback.
	* alphafbsd-tdep.c (alphafbsd_pc_in_sigtramp): Add GDBARCH parameter.
	(alphafbsd_sigtramp_offset): Likewise.
	* alpha-linux-tdep.c (alpha_linux_sigtramp_offset_1): Add GDBARCH
	parameter.  Pass to alpha_read_insn.
	(alpha_linux_sigtramp_offset): Add GDBARCH parameter.  Pass to
	alpha_linux_sigtramp_offset_1.
	(alpha_linux_pc_in_sigtramp): Add GDBARCH parameter.  Pass to
	alpha_linux_sigtramp_offset.
	(alpha_linux_sigcontext_addr): Pass architecture to alpha_read_insn
	and alpha_linux_sigtramp_offset.
	* alphanbsd-tdep.c (alphanbsd_sigtramp_offset): Add GDBARCH parameter.
	(alphanbsd_pc_in_sigtramp): Add GDBARCH parameter.  Pass to
	alphanbsd_sigtramp_offset.
	* alphaobsd-tdep.c (alphaobsd_sigtramp_offset): Add GDBARCH parameter.
	(alphaobsd_pc_in_sigtramp): Add GDBARCH parameter.  Pass to
	alpha_read_insn.
	(alphaobsd_sigcontext_addr): Pass architecture to
	alphaobsd_sigtramp_offset.
	* alpha-osf1-tdep.c (alpha_osf1_pc_in_sigtramp): Add GDBARCH
	parameter.

	* amd64-tdep.c (amd64_analyze_prologue): Add GDBARCH parameter.
	(amd64_skip_prologue): Pass architecture to amd64_analyze_prologue.
	(amd64_frame_cache): Likewise.

	* arm-tdep.c (SWAP_SHORT, SWAP_INT): Remove.
	(thumb_analyze_prologue, arm_skip_prologue, arm_scan_prologue,
	thumb_get_next_pc, arm_get_next_pc): Do not use SWAP_ macros.
	* arm-wince-tdep.c: Include "frame.h".

	* avr-tdep.c (EXTRACT_INSN): Remove.
	(avr_scan_prologue): Add GDBARCH argument, inline EXTRACT_INSN.
	(avr_skip_prologue): Pass architecture to avr_scan_prologue.
	(avr_frame_unwind_cache): Likewise.

	* cris-tdep.c (struct instruction_environment): Add BYTE_ORDER member.
	(find_step_target): Initialize it.
	(get_data_from_address): Add BYTE_ORDER parameter.
	(bdap_prefix): Pass byte order to get_data_from_address.
	(handle_prefix_assign_mode_for_aritm_op): Likewise.
	(three_operand_add_sub_cmp_and_or_op): Likewise.
	(handle_inc_and_index_mode_for_aritm_op): Likewise.

	* frv-linux-tdep.c (frv_linux_pc_in_sigtramp): Add GDBARCH parameter.
	(frv_linux_sigcontext_reg_addr): Pass architecture to
	frv_linux_pc_in_sigtramp.
	(frv_linux_sigtramp_frame_sniffer): Likewise.

	* h8300-tdep.c (h8300_is_argument_spill): Add GDBARCH parameter.
	(h8300_analyze_prologue): Add GDBARCH parameter.  Pass to
	h8300_is_argument_spill.
	(h8300_frame_cache, h8300_skip_prologue): Pass architecture
	to h8300_analyze_prologue.

	* hppa-tdep.h (struct gdbarch_tdep): Add GDBARCH parameter to
	in_solib_call_trampoline callback.
	(hppa_in_solib_call_trampoline): Add GDBARCH parameter.
	* hppa-tdep.c (hppa64_convert_code_addr_to_fptr): Add GDBARCH
	parameter.
	(hppa64_push_dummy_call): Pass architecture to
	hppa64_convert_code_addr_to_fptr.
	(hppa_match_insns): Add GDBARCH parameter.
	(hppa_match_insns_relaxed): Add GDBARCH parameter.  Pass to
	hppa_match_insns.
	(hppa_skip_trampoline_code): Pass architecture to hppa_match_insns.
	(hppa_in_solib_call_trampoline): Add GDBARCH parameter.  Pass to
	hppa_match_insns_relaxed.
	(hppa_stub_unwind_sniffer): Pass architecture to
	tdep->in_solib_call_trampoline callback.
	* hppa-hpux-tdep.c (hppa_hpux_search_pattern): Add GDBARCH parameter.
	(hppa32_hpux_search_dummy_call_sequence): Pass architecture to
	hppa_hpux_search_pattern.
	* hppa-linux-tdep.c (insns_match_pattern): Add GDBARCH parameter.
	(hppa_linux_sigtramp_find_sigcontext): Add GDBARCH parameter.
	Pass to insns_match_pattern.
	(hppa_linux_sigtramp_frame_unwind_cache): Pass architecture to
	hppa_linux_sigtramp_find_sigcontext.
	(hppa_linux_sigtramp_frame_sniffer): Likewise.
	(hppa32_hpux_in_solib_call_trampoline): Add GDBARCH parameter.
	(hppa64_hpux_in_solib_call_trampoline): Likewise.

	* i386-tdep.c (i386_follow_jump): Add GDBARCH parameter.
	(i386_analyze_frame_setup): Add GDBARCH parameter.
	(i386_analyze_prologue): Add GDBARCH parameter.  Pass to
	i386_follow_jump and i386_analyze_frame_setup.
	(i386_skip_prologue): Pass architecture to i386_analyze_prologue
	and i386_follow_jump.
	(i386_frame_cache): Pass architecture to i386_analyze_prologue.
	(i386_pe_skip_trampoline_code): Add FRAME parameter.
	* i386-tdep.h (i386_pe_skip_trampoline_code): Add FRAME parameter.
	* i386-cygwin-tdep.c (i386_cygwin_skip_trampoline_code): Pass
	frame to i386_pe_skip_trampoline_code.

	* ia64-tdep.h (struct gdbarch_tdep): Add GDBARCH parameter
	to sigcontext_register_address callback.
	* ia64-tdep.c (ia64_find_global_pointer): Add GDBARCH parameter.
	(ia64_find_unwind_table): Pass architecture to
	ia64_find_global_pointer.
	(find_extant_func_descr): Add GDBARCH parameter.
	(find_func_descr): Pass architecture to find_extant_func_descr
	and ia64_find_global_pointer.
	(ia64_sigtramp_frame_init_saved_regs): Pass architecture to
	tdep->sigcontext_register_address callback.
	* ia64-linux-tdep.c (ia64_linux_sigcontext_register_address): Add
	GDBARCH parameter.

	* iq2000-tdep.c (iq2000_scan_prologue): Add GDBARCH parameter.
	(iq2000_frame_cache): Pass architecture to iq2000_scan_prologue.

	* lm32-tdep.c (lm32_analyze_prologue): Add GDBARCH parameter.
	(lm32_skip_prologue, lm32_frame_cache): Pass architecture to
	lm32_analyze_prologue.

	* m32r-tdep.c (decode_prologue): Add GDBARCH parameter.
	(m32r_skip_prologue): Pass architecture to decode_prologue.

	* m68hc11-tdep.c (m68hc11_analyze_instruction): Add GDBARCH parameter.
	(m68hc11_scan_prologue): Pass architecture to
	m68hc11_analyze_instruction.

	* m68k-tdep.c (m68k_analyze_frame_setup): Add GDBARCH parameter.
	(m68k_analyze_prologue): Pass architecture to
	m68k_analyze_frame_setup.

	* m88k-tdep.c (m88k_fetch_instruction): Add BYTE_ORDER parameter.
	(m88k_analyze_prologue): Add GDBARCH parameter.  Pass byte order
	to m88k_fetch_instruction.
	(m88k_skip_prologue): Pass architecture to m88k_analyze_prologue.
	(m88k_frame_cache): Likewise.

	* mep-tdep.c (mep_get_insn): Add GDBARCH parameter.
	(mep_analyze_prologue): Pass architecture to mep_get_insn.

	* mips-tdep.c (mips_fetch_instruction): Add GDBARCH parameter.
	(mips32_next_pc): Pass architecture to mips_fetch_instruction.
	(deal_with_atomic_sequence): Likewise.
	(unpack_mips16): Add GDBARCH parameter, pass to mips_fetch_instruction.
	(mips16_scan_prologue): Likewise.
	(mips32_scan_prologue): Likewise.
	(mips16_in_function_epilogue_p): Likewise.
	(mips32_in_function_epilogue_p): Likewise.
	(mips_about_to_return): Likewise.
	(mips_insn16_frame_cache): Pass architecture to mips16_scan_prologue.
	(mips_insn32_frame_cache): Pass architecture to mips32_scan_prologue.
	(mips_skip_prologue): Pass architecture to mips16_scan_prologue
	and mips32_scan_prologue.
	(mips_in_function_epilogue_p): Pass architecture to
	mips16_in_function_epilogue_p and
	mips32_in_function_epilogue_p.
	(heuristic_proc_start): Pass architecture to mips_fetch_instruction
	and mips_about_to_return.
	(mips_skip_mips16_trampoline_code): Pass architecture to
	mips_fetch_instruction.
	(fetch_mips_16): Add GDBARCH parameter.
	(mips16_next_pc): Pass architecture to fetch_mips_16.
	(extended_mips16_next_pc): Pass architecture to unpack_mips16 and
	fetch_mips_16.

	* objc-lang.c (read_objc_method, read_objc_methlist_nmethods,
	read_objc_methlist_method, read_objc_object, read_objc_super,
	read_objc_class): Add GDBARCH parameter.
	(find_implementation_from_class): Add GDBARCH parameter, pass
	to read_objc_class, read_objc_methlist_nmethods, and
	read_objc_methlist_method.
	(find_implementation): Add GDBARCH parameter, pass to
	read_objc_object and find_implementation_from_class.
	(resolve_msgsend, resolve_msgsend_stret): Pass architecture
	to find_implementation.
	(resolve_msgsend_super, resolve_msgsend_super_stret): Pass
	architecture to read_objc_super and find_implementation_from_class.

	* ppc64-linux-tdep.c (ppc64_desc_entry_point): Add GDBARCH parameter.
	(ppc64_standard_linkage1_target, ppc64_standard_linkage2_target,
	ppc64_standard_linkage3_target): Pass architecture to
	ppc64_desc_entry_point.
	* rs6000-tdep.c (bl_to_blrl_insn_p): Add BYTE_ORDER parameter.
	(skip_prologue): Pass byte order to bl_to_blrl_insn_p.
	(rs6000_fetch_instruction): Add GDBARCH parameter.
	(rs6000_skip_stack_check): Add GDBARCH parameter, pass to
	rs6000_fetch_instruction.
	(skip_prologue): Pass architecture to rs6000_fetch_instruction.

	* remote-mips.c (mips_store_word): Return old_contents as host
	integer value instead of target bytes.

	* s390-tdep.c (struct s390_prologue_data): Add BYTE_ORDER member.
	(s390_analyze_prologue): Initialize it.
	(extend_simple_arg): Add GDBARCH parameter.
	(s390_push_dummy_call): Pass architecture to extend_simple_arg.

	* scm-lang.c (scm_get_field): Add BYTE_ORDER parameter.
	* scm-lang.h (scm_get_field): Add BYTE_ORDER parameter.
	(SCM_CAR, SCM_CDR): Pass SCM_BYTE_ORDER to scm_get_field.
	* scm-valprint.c (scm_scmval_print): Likewise.
	(scm_scmlist_print, scm_ipruk, scm_scmval_print): Define
	SCM_BYTE_ORDER.

	* sh64-tdep.c (look_for_args_moves): Add GDBARCH parameter.
	(sh64_skip_prologue_hard_way): Add GDBARCH parameter, pass to
	look_for_args_moves.
	(sh64_skip_prologue): Pass architecture to
	sh64_skip_prologue_hard_way.
	* sh-tdep.c (sh_analyze_prologue): Add GDBARCH parameter.
	(sh_skip_prologue): Pass architecture to sh_analyze_prologue.
	(sh_frame_cache): Likewise.

	* solib-irix.c (extract_mips_address): Add GDBARCH parameter.
	(fetch_lm_info, irix_current_sos, irix_open_symbol_file_object):
	Pass architecture to extract_mips_address.

	* sparc-tdep.h (sparc_fetch_wcookie): Add GDBARCH parameter.
	* sparc-tdep.c (sparc_fetch_wcookie): Add GDBARCH parameter.
	(sparc_supply_rwindow, sparc_collect_rwindow): Pass architecture
	to sparc_fetch_wcookie.
	(sparc32_frame_prev_register): Likewise.
	* sparc64-tdep.c (sparc64_frame_prev_register): Likewise.
	* sparc32nbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise.
	* sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise.

	* spu-tdep.c (spu_analyze_prologue): Add GDBARCH parameter.
	(spu_skip_prologue): Pass architecture to spu_analyze_prologue.
	(spu_virtual_frame_pointer): Likewise.
	(spu_frame_unwind_cache): Likewise.
	(info_spu_mailbox_list): Add BYTE_ORER parameter.
	(info_spu_mailbox_command): Pass byte order to info_spu_mailbox_list.
	(info_spu_dma_cmdlist): Add BYTE_ORER parameter.
	(info_spu_dma_command, info_spu_proxydma_command): Pass byte order
	to info_spu_dma_cmdlist.

	* symfile.c (read_target_long_array): Add GDBARCH parameter.
	(simple_read_overlay_table, simple_read_overlay_region_table,
	simple_overlay_update_1): Pass architecture to read_target_long_array.

	* v850-tdep.c (v850_analyze_prologue): Add GDBARCH parameter.
	(v850_frame_cache): Pass architecture to v850_analyze_prologue.

	* xstormy16-tdep.c (xstormy16_analyze_prologue): Add GDBARCH
	parameter.
	(xstormy16_skip_prologue, xstormy16_frame_cache): Pass architecture
	to xstormy16_analyze_prologue.
	(xstormy16_resolve_jmp_table_entry): Add GDBARCH parameter.
	(xstormy16_find_jmp_table_entry): Likewise.
	(xstormy16_skip_trampoline_code): Pass architecture to
	xstormy16_resolve_jmp_table_entry.
	(xstormy16_pointer_to_address): Likewise.
	(xstormy16_address_to_pointer): Pass architecture to
	xstormy16_find_jmp_table_entry.

	* xtensa-tdep.c (call0_track_op): Add GDBARCH parameter.
	(call0_analyze_prologue): Add GDBARCH parameter, pass to
	call0_track_op.
	(call0_frame_cache): Pass architecture to call0_analyze_prologue.
	(xtensa_skip_prologue): Likewise.
This commit is contained in:
Ulrich Weigand 2009-07-02 17:25:59 +00:00
parent 5af949e350
commit e17a411335
145 changed files with 2989 additions and 1465 deletions

View file

@ -1,3 +1,629 @@
2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
* defs.h (extract_signed_integer, extract_unsigned_integer,
extract_long_unsigned_integer, store_signed_integer,
store_unsigned_integer): Add BYTE_ORDER parameter.
* findvar.c (extract_signed_integer, extract_unsigned_integer,
extract_long_unsigned_integer, store_signed_integer,
store_unsigned_integer): Add BYTE_ORDER parameter. Use it
instead of current_gdbarch.
* gdbcore.h (read_memory_integer, safe_read_memory_integer,
read_memory_unsigned_integer, write_memory_signed_integer,
write_memory_unsigned_integer): Add BYTE_ORDER parameter.
* corefile.c (struct captured_read_memory_integer_arguments): Add
BYTE_ORDER member.
(safe_read_memory_integer): Add BYTE_ORDER parameter. Store it into
struct captured_read_memory_integer_arguments.
(do_captured_read_memory_integer): Pass it to read_memory_integer.
(read_memory_integer): Add BYTE_ORDER parameter. Pass it to
extract_signed_integer.
(read_memory_unsigned_integer): Add BYTE_ORDER parameter. Pass it to
extract_unsigned_integer.
(write_memory_signed_integer): Add BYTE_ORDER parameter. Pass it
to store_signed_integer.
(write_memory_unsigned_integer): Add BYTE_ORDER parameter. Pass it
to store_unsigned_integer.
* target.h (get_target_memory_unsigned): Add BYTE_ORDER parameter.
* target.c (get_target_memory_unsigned): Add BYTE_ORDER parameter.
Pass it to extract_unsigned_integer.
Update calls to extract_signed_integer, extract_unsigned_integer,
extract_long_unsigned_integer, store_signed_integer,
store_unsigned_integer, read_memory_integer,
read_memory_unsigned_integer, safe_read_memory_integer,
write_memory_signed_integer, write_memory_unsigned_integer, and
get_target_memory_unsigned to pass byte order:
* ada-lang.c (ada_value_binop): Update.
* ada-valprint.c (char_at): Update.
* alpha-osf1-tdep.c (alpha_osf1_sigcontext_addr): Update.
* alpha-tdep.c (alpha_lds, alpha_sts, alpha_push_dummy_call,
alpha_extract_return_value, alpha_read_insn,
alpha_get_longjmp_target): Update.
* amd64-linux-tdep.c (amd64_linux_sigcontext_addr): Update.
* amd64obsd-tdep.c (amd64obsd_supply_uthread,
amd64obsd_collect_uthread, amd64obsd_trapframe_cache): Update.
* amd64-tdep.c (amd64_push_dummy_call, amd64_analyze_prologue,
amd64_frame_cache, amd64_sigtramp_frame_cache, fixup_riprel,
amd64_displaced_step_fixup): Update.
* arm-linux-tdep.c (arm_linux_sigreturn_init,
arm_linux_rt_sigreturn_init, arm_linux_supply_gregset): Update.
* arm-tdep.c (thumb_analyze_prologue, arm_skip_prologue,
arm_scan_prologue, arm_push_dummy_call, thumb_get_next_pc,
arm_get_next_pc, arm_extract_return_value, arm_store_return_value,
arm_return_value): Update.
* arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update.
* auxv.c (default_auxv_parse): Update.
* avr-tdep.c (avr_address_to_pointer, avr_pointer_to_address,
avr_scan_prologue, avr_extract_return_value,
avr_frame_prev_register, avr_push_dummy_call): Update.
* bsd-uthread.c (bsd_uthread_check_magic, bsd_uthread_lookup_offset,
bsd_uthread_wait, bsd_uthread_thread_alive,
bsd_uthread_extra_thread_info): Update.
* c-lang.c (c_printstr, print_wchar): Update.
* cp-valprint.c (cp_print_class_member): Update.
* cris-tdep.c (cris_sigcontext_addr, cris_sigtramp_frame_unwind_cache,
cris_push_dummy_call, cris_scan_prologue, cris_store_return_value,
cris_extract_return_value, find_step_target, dip_prefix,
sixteen_bit_offset_branch_op, none_reg_mode_jump_op,
move_mem_to_reg_movem_op, get_data_from_address): Update.
* dwarf2expr.c (dwarf2_read_address, execute_stack_op): Update.
* dwarf2-frame.c (execute_cfa_program): Update.
* dwarf2loc.c (find_location_expression): Update.
* dwarf2read.c (dwarf2_const_value): Update.
* expprint.c (print_subexp_standard): Update.
* findvar.c (unsigned_pointer_to_address, signed_pointer_to_address,
unsigned_address_to_pointer, address_to_signed_pointer,
read_var_value): Update.
* frame.c (frame_unwind_register_signed,
frame_unwind_register_unsigned, get_frame_memory_signed,
get_frame_memory_unsigned): Update.
* frame-unwind.c (frame_unwind_got_constant): Update.
* frv-linux-tdep.c (frv_linux_pc_in_sigtramp,
frv_linux_sigcontext_reg_addr, frv_linux_sigtramp_frame_cache):
Update.
* frv-tdep.c (frv_analyze_prologue, frv_skip_main_prologue,
frv_extract_return_value, find_func_descr,
frv_convert_from_func_ptr_addr, frv_push_dummy_call): Update.
* f-valprint.c (f_val_print): Update.
* gnu-v3-abi.c (gnuv3_decode_method_ptr, gnuv3_make_method_ptr):
Update.
* h8300-tdep.c (h8300_is_argument_spill, h8300_analyze_prologue,
h8300_push_dummy_call, h8300_extract_return_value,
h8300h_extract_return_value, h8300_store_return_value,
h8300h_store_return_value): Update.
* hppabsd-tdep.c (hppabsd_find_global_pointer): Update.
* hppa-hpux-nat.c (hppa_hpux_fetch_register, hppa_hpux_store_register):
Update.
* hppa-hpux-tdep.c (hppa32_hpux_in_solib_call_trampoline,
hppa64_hpux_in_solib_call_trampoline,
hppa_hpux_in_solib_return_trampoline, hppa_hpux_skip_trampoline_code,
hppa_hpux_sigtramp_frame_unwind_cache,
hppa_hpux_sigtramp_unwind_sniffer, hppa32_hpux_find_global_pointer,
hppa64_hpux_find_global_pointer, hppa_hpux_search_pattern,
hppa32_hpux_search_dummy_call_sequence,
hppa64_hpux_search_dummy_call_sequence, hppa_hpux_supply_save_state,
hppa_hpux_unwind_adjust_stub): Update.
* hppa-linux-tdep.c (insns_match_pattern,
hppa_linux_find_global_pointer): Update.
* hppa-tdep.c (hppa_in_function_epilogue_p, hppa32_push_dummy_call,
hppa64_convert_code_addr_to_fptr, hppa64_push_dummy_call,
skip_prologue_hard_way, hppa_frame_cache, hppa_fallback_frame_cache,
hppa_pseudo_register_read, hppa_frame_prev_register_helper,
hppa_match_insns): Update.
* hpux-thread.c (hpux_thread_fetch_registers): Update.
* i386-tdep.c (i386bsd_sigcontext_addr): Update.
* i386-cygwin-tdep.c (core_process_module_section): Update.
* i386-darwin-nat.c (i386_darwin_sstep_at_sigreturn,
amd64_darwin_sstep_at_sigreturn): Update.
* i386-darwin-tdep.c (i386_darwin_sigcontext_addr,
amd64_darwin_sigcontext_addr): Likewise.
* i386-linux-nat.c (i386_linux_sigcontext_addr): Update.
* i386nbsd-tdep.c (i386nbsd_sigtramp_cache_init): Update.
* i386-nto-tdep.c (i386nto_sigcontext_addr): Update.
* i386obsd-nat.c (i386obsd_supply_pcb): Update.
* i386obsd-tdep.c (i386obsd_supply_uthread, i386obsd_collect_uthread,
i386obsd_trapframe_cache): Update.
* i386-tdep.c (i386_displaced_step_fixup, i386_follow_jump,
i386_analyze_frame_setup, i386_analyze_prologue,
i386_skip_main_prologue, i386_frame_cache, i386_sigtramp_frame_cache,
i386_get_longjmp_target, i386_push_dummy_call,
i386_pe_skip_trampoline_code, i386_svr4_sigcontext_addr,
i386_fetch_pointer_argument): Update.
* i387-tdep.c (i387_supply_fsave): Update.
* ia64-linux-tdep.c (ia64_linux_sigcontext_register_address): Update.
* ia64-tdep.c (ia64_pseudo_register_read, ia64_pseudo_register_write,
examine_prologue, ia64_frame_cache, ia64_frame_prev_register,
ia64_sigtramp_frame_cache, ia64_sigtramp_frame_prev_register,
ia64_access_reg, ia64_access_rse_reg, ia64_libunwind_frame_this_id,
ia64_libunwind_frame_prev_register,
ia64_libunwind_sigtramp_frame_this_id,
ia64_libunwind_sigtramp_frame_prev_register, ia64_find_global_pointer,
find_extant_func_descr, find_func_descr,
ia64_convert_from_func_ptr_addr, ia64_push_dummy_call, ia64_dummy_id,
ia64_unwind_pc): Update.
* iq2000-tdep.c (iq2000_pointer_to_address, iq2000_address_to_pointer,
iq2000_scan_prologue, iq2000_extract_return_value,
iq2000_push_dummy_call): Update.
* irix5nat.c (fill_gregset): Update.
* jv-lang.c (evaluate_subexp_java): Update.
* jv-valprint.c (java_value_print): Update.
* lm32-tdep.c (lm32_analyze_prologue, lm32_push_dummy_call,
lm32_extract_return_value, lm32_store_return_value): Update.
* m32c-tdep.c (m32c_push_dummy_call, m32c_return_value,
m32c_skip_trampoline_code, m32c_m16c_address_to_pointer,
m32c_m16c_pointer_to_address): Update.
* m32r-tdep.c (m32r_store_return_value, decode_prologue,
m32r_skip_prologue, m32r_push_dummy_call, m32r_extract_return_value):
Update.
* m68hc11-tdep.c (m68hc11_pseudo_register_read,
m68hc11_pseudo_register_write, m68hc11_analyze_instruction,
m68hc11_push_dummy_call): Update.
* m68linux-tdep.c (m68k_linux_pc_in_sigtramp,
m68k_linux_get_sigtramp_info, m68k_linux_sigtramp_frame_cache):
Update.
* m68k-tdep.c (m68k_push_dummy_call, m68k_analyze_frame_setup,
m68k_analyze_register_saves, m68k_analyze_prologue, m68k_frame_cache,
m68k_get_longjmp_target): Update.
* m88k-tdep.c (m88k_fetch_instruction): Update.
* mep-tdep.c (mep_pseudo_cr32_read, mep_pseudo_csr_write,
mep_pseudo_cr32_write, mep_get_insn, mep_push_dummy_call): Update.
* mi/mi-main.c (mi_cmd_data_write_memory): Update.
* mips-linux-tdep.c (mips_linux_get_longjmp_target, supply_32bit_reg,
mips64_linux_get_longjmp_target, mips64_fill_gregset,
mips64_fill_fpregset, mips_linux_in_dynsym_stub): Update.
* mipsnbdsd-tdep.c (mipsnbsd_get_longjmp_target): Update.
* mips-tdep.c (mips_fetch_instruction, fetch_mips_16,
mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call,
mips_o32_push_dummy_call, mips_o64_push_dummy_call,
mips_single_step_through_delay, mips_skip_pic_trampoline_code,
mips_integer_to_address): Update.
* mn10300-tdep.c (mn10300_analyze_prologue, mn10300_push_dummy_call):
Update.
* monitor.c (monitor_supply_register, monitor_write_memory,
monitor_read_memory_single): Update.
* moxie-tdep.c (moxie_store_return_value, moxie_extract_return_value,
moxie_analyze_prologue): Update.
* mt-tdep.c (mt_return_value, mt_skip_prologue, mt_select_coprocessor,
mt_pseudo_register_read, mt_pseudo_register_write, mt_registers_info,
mt_push_dummy_call): Update.
* objc-lang.c (read_objc_method, read_objc_methlist_nmethods,
read_objc_methlist_method, read_objc_object, read_objc_super,
read_objc_class, find_implementation_from_class): Update.
* ppc64-linux-tdep.c (ppc64_desc_entry_point,
ppc64_linux_convert_from_func_ptr_addr, ppc_linux_sigtramp_cache):
Update.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_sniffer,
ppcobsd_sigtramp_frame_cache): Update.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call,
do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call,
ppc64_sysv_abi_return_value): Update.
* ppc-linux-nat.c (ppc_linux_auxv_parse): Update.
* procfs.c (procfs_auxv_parse): Update.
* p-valprint.c (pascal_val_print): Update.
* regcache.c (regcache_raw_read_signed, regcache_raw_read_unsigned,
regcache_raw_write_signed, regcache_raw_write_unsigned,
regcache_cooked_read_signed, regcache_cooked_read_unsigned,
regcache_cooked_write_signed, regcache_cooked_write_unsigned): Update.
* remote-m32r-sdi.c (m32r_fetch_register): Update.
* remote-mips.c (mips_wait, mips_fetch_registers, mips_xfer_memory):
Update.
* rs6000-aix-tdep.c (rs6000_push_dummy_call, rs6000_return_value,
rs6000_convert_from_func_ptr_addr, branch_dest,
rs6000_software_single_step): Update.
* rs6000-tdep.c (rs6000_in_function_epilogue_p,
ppc_displaced_step_fixup, ppc_deal_with_atomic_sequence,
bl_to_blrl_insn_p, rs6000_fetch_instruction, skip_prologue,
rs6000_skip_main_prologue, rs6000_skip_trampoline_code,
rs6000_frame_cache): Update.
* s390-tdep.c (s390_pseudo_register_read, s390_pseudo_register_write,
s390x_pseudo_register_read, s390x_pseudo_register_write, s390_load,
s390_backchain_frame_unwind_cache, s390_sigtramp_frame_unwind_cache,
extend_simple_arg, s390_push_dummy_call, s390_return_value): Update.
* scm-exp.c (scm_lreadr): Update.
* scm-lang.c (scm_get_field, scm_unpack): Update.
* scm-valprint.c (scm_val_print): Update.
* score-tdep.c (score_breakpoint_from_pc, score_push_dummy_call,
score_fetch_inst): Update.
* sh64-tdep.c (look_for_args_moves, sh64_skip_prologue_hard_way,
sh64_analyze_prologue, sh64_push_dummy_call, sh64_extract_return_value,
sh64_pseudo_register_read, sh64_pseudo_register_write,
sh64_frame_prev_register): Update:
* sh-tdep.c (sh_analyze_prologue, sh_push_dummy_call_fpu,
sh_push_dummy_call_nofpu, sh_extract_return_value_nofpu,
sh_store_return_value_nofpu, sh_in_function_epilogue_p): Update.
* solib-darwin.c (darwin_load_image_infos): Update.
* solib-frv.c (fetch_loadmap, lm_base, frv_current_sos, enable_break2,
find_canonical_descriptor_in_load_object): Update.
* solib-irix.c (extract_mips_address, fetch_lm_info, irix_current_sos,
irix_open_symbol_file_object): Update.
* solib-som.c (som_solib_create_inferior_hook, link_map_start,
som_current_sos, som_open_symbol_file_object): Update.
* solib-sunos.c (SOLIB_EXTRACT_ADDRESS, LM_ADDR, LM_NEXT, LM_NAME):
Update.
* solib-svr4.c (read_program_header, scan_dyntag_auxv,
solib_svr4_r_ldsomap): Update.
* sparc64-linux-tdep.c (sparc64_linux_step_trap): Update.
* sparc64obsd-tdep.c (sparc64obsd_supply_uthread,
sparc64obsd_collect_uthread): Update.
* sparc64-tdep.c (sparc64_pseudo_register_read,
sparc64_pseudo_register_write, sparc64_supply_gregset,
sparc64_collect_gregset): Update.
* sparc-linux-tdep.c (sparc32_linux_step_trap): Update.
* sparcobsd-tdep.c (sparc32obsd_supply_uthread,
sparc32obsd_collect_uthread): Update.
* sparc-tdep.c (sparc_fetch_wcookie, sparc32_push_dummy_code,
sparc32_store_arguments, sparc32_return_value, sparc_supply_rwindow,
sparc_collect_rwindow): Update.
* spu-linux-nat.c (parse_spufs_run): Update.
* spu-tdep.c (spu_pseudo_register_read_spu,
spu_pseudo_register_write_spu, spu_pointer_to_address,
spu_analyze_prologue, spu_in_function_epilogue_p,
spu_frame_unwind_cache, spu_push_dummy_call, spu_software_single_step,
spu_get_longjmp_target, spu_get_overlay_table, spu_overlay_update_osect,
info_spu_signal_command, info_spu_mailbox_list, info_spu_dma_cmdlist,
info_spu_dma_command, info_spu_proxydma_command): Update.
* stack.c (print_frame_nameless_args, frame_info): Update.
* symfile.c (read_target_long_array, simple_read_overlay_table,
simple_read_overlay_region_table): Update.
* target.c (debug_print_register): Update.
* tramp-frame.c (tramp_frame_start): Update.
* v850-tdep.c (v850_analyze_prologue, v850_push_dummy_call,
v850_extract_return_value, v850_store_return_value,
* valarith.c (value_binop, value_bit_index): Update.
* valops.c (value_cast): Update.
* valprint.c (val_print_type_code_int, val_print_string,
read_string): Update.
* value.c (unpack_long, unpack_double, unpack_field_as_long,
modify_field, pack_long): Update.
* vax-tdep.c (vax_store_arguments, vax_push_dummy_call,
vax_skip_prologue): Update.
* xstormy16-tdep.c (xstormy16_push_dummy_call,
xstormy16_analyze_prologue, xstormy16_in_function_epilogue_p,
xstormy16_resolve_jmp_table_entry, xstormy16_find_jmp_table_entry,
xstormy16_pointer_to_address, xstormy16_address_to_pointer): Update.
* xtensa-tdep.c (extract_call_winsize, xtensa_pseudo_register_read,
xtensa_pseudo_register_write, xtensa_frame_cache,
xtensa_push_dummy_call, call0_track_op, call0_frame_cache): Update.
* dfp.h (decimal_to_string, decimal_from_string, decimal_from_integral,
decimal_from_floating, decimal_to_doublest, decimal_is_zero): Add
BYTE_ORDER parameter.
(decimal_binop): Add BYTE_ORDER_X, BYTE_ORDER_Y, and BYTE_ORDER_RESULT
parameters.
(decimal_compare): Add BYTE_ORDER_X and BYTE_ORDER_Y parameters.
(decimal_convert): Add BYTE_ORDER_FROM and BYTE_ORDER_TO parameters.
* dfp.c (match_endianness): Add BYTE_ORDER parameter. Use it
instead of current_gdbarch.
(decimal_to_string, decimal_from_integral, decimal_from_floating,
decimal_to_doublest, decimal_is_zero): Add BYTE_ORDER parameter.
Pass it to match_endianness.
(decimal_binop): Add BYTE_ORDER_X, BYTE_ORDER_Y, and BYTE_ORDER_RESULT
parameters. Pass them to match_endianness.
(decimal_compare): Add BYTE_ORDER_X and BYTE_ORDER_Y parameters.
Pass them to match_endianness.
(decimal_convert): Add BYTE_ORDER_FROM and BYTE_ORDER_TO parameters.
Pass them to match_endianness.
* valarith.c (value_args_as_decimal): Add BYTE_ORDER_X and
BYTE_ORDER_Y output parameters.
(value_binop): Update call to value_args_as_decimal.
Update calls to decimal_to_string, decimal_from_string,
decimal_from_integral, decimal_from_floating, decimal_to_doublest,
decimal_is_zero, decimal_binop, decimal_compare and decimal_convert
to pass/receive byte order:
* c-exp.y (parse_number): Update.
* printcmd.c (printf_command): Update.
* valarith.c (value_args_as_decimal, value_binop, value_logical_not,
value_equal, value_less): Update.
* valops.c (value_cast, value_one): Update.
* valprint.c (print_decimal_floating): Update.
* value.c (unpack_long, unpack_double): Update.
* python/python-value.c (valpy_nonzero): Update.
* ada-valprint.c (char_at): Add BYTE_ORDER parameter.
(printstr): Update calls to char_at.
(ada_val_print_array): Likewise.
* valprint.c (read_string): Add BYTE_ORDER parameter.
(val_print_string): Update call to read_string.
* c-lang.c (c_get_string): Likewise.
* charset.h (target_wide_charset): Add BYTE_ORDER parameter.
* charset.c (target_wide_charset): Add BYTE_ORDER parameter.
Use it instead of current_gdbarch.
* printcmd.c (printf_command): Update calls to target_wide_charset.
* c-lang.c (charset_for_string_type): Add BYTE_ORDER parameter.
Pass to target_wide_charset. Use it instead of current_gdbarch.
(classify_type): Add BYTE_ORDER parameter. Pass to
charset_for_string_type. Allow NULL encoding pointer.
(print_wchar): Add BYTE_ORDER parameter.
(c_emit_char): Update calls to classify_type and print_wchar.
(c_printchar, c_printstr): Likewise.
* gdbarch.sh (in_solib_return_trampoline): Convert to type "m".
* gdbarch.c, gdbarch.h: Regenerate.
* arch-utils.h (generic_in_solib_return_trampoline): Add GDBARCH
parameter.
* arch-utils.c (generic_in_solib_return_trampoline): Likewise.
* hppa-hpux-tdep.c (hppa_hpux_in_solib_return_trampoline): Likewise.
* rs6000-tdep.c (rs6000_in_solib_return_trampoline): Likewise.
(rs6000_skip_trampoline_code): Update call.
* alpha-tdep.h (struct gdbarch_tdep): Add GDBARCH parameter to
dynamic_sigtramp_offset and pc_in_sigtramp callbacks.
(alpha_read_insn): Add GDBARCH parameter.
* alpha-tdep.c (alpha_lds, alpha_sts): Add GDBARCH parameter.
(alpha_register_to_value): Pass architecture to alpha_sts.
(alpha_extract_return_value): Likewise.
(alpha_value_to_register): Pass architecture to alpha_lds.
(alpha_store_return_value): Likewise.
(alpha_read_insn): Add GDBARCH parameter.
(alpha_skip_prologue): Pass architecture to alpha_read_insn.
(alpha_heuristic_proc_start): Likewise.
(alpha_heuristic_frame_unwind_cache): Likewise.
(alpha_next_pc): Likewise.
(alpha_sigtramp_frame_this_id): Pass architecture to
tdep->dynamic_sigtramp_offset callback.
(alpha_sigtramp_frame_sniffer): Pass architecture to
tdep->pc_in_sigtramp callback.
* alphafbsd-tdep.c (alphafbsd_pc_in_sigtramp): Add GDBARCH parameter.
(alphafbsd_sigtramp_offset): Likewise.
* alpha-linux-tdep.c (alpha_linux_sigtramp_offset_1): Add GDBARCH
parameter. Pass to alpha_read_insn.
(alpha_linux_sigtramp_offset): Add GDBARCH parameter. Pass to
alpha_linux_sigtramp_offset_1.
(alpha_linux_pc_in_sigtramp): Add GDBARCH parameter. Pass to
alpha_linux_sigtramp_offset.
(alpha_linux_sigcontext_addr): Pass architecture to alpha_read_insn
and alpha_linux_sigtramp_offset.
* alphanbsd-tdep.c (alphanbsd_sigtramp_offset): Add GDBARCH parameter.
(alphanbsd_pc_in_sigtramp): Add GDBARCH parameter. Pass to
alphanbsd_sigtramp_offset.
* alphaobsd-tdep.c (alphaobsd_sigtramp_offset): Add GDBARCH parameter.
(alphaobsd_pc_in_sigtramp): Add GDBARCH parameter. Pass to
alpha_read_insn.
(alphaobsd_sigcontext_addr): Pass architecture to
alphaobsd_sigtramp_offset.
* alpha-osf1-tdep.c (alpha_osf1_pc_in_sigtramp): Add GDBARCH
parameter.
* amd64-tdep.c (amd64_analyze_prologue): Add GDBARCH parameter.
(amd64_skip_prologue): Pass architecture to amd64_analyze_prologue.
(amd64_frame_cache): Likewise.
* arm-tdep.c (SWAP_SHORT, SWAP_INT): Remove.
(thumb_analyze_prologue, arm_skip_prologue, arm_scan_prologue,
thumb_get_next_pc, arm_get_next_pc): Do not use SWAP_ macros.
* arm-wince-tdep.c: Include "frame.h".
* avr-tdep.c (EXTRACT_INSN): Remove.
(avr_scan_prologue): Add GDBARCH argument, inline EXTRACT_INSN.
(avr_skip_prologue): Pass architecture to avr_scan_prologue.
(avr_frame_unwind_cache): Likewise.
* cris-tdep.c (struct instruction_environment): Add BYTE_ORDER member.
(find_step_target): Initialize it.
(get_data_from_address): Add BYTE_ORDER parameter.
(bdap_prefix): Pass byte order to get_data_from_address.
(handle_prefix_assign_mode_for_aritm_op): Likewise.
(three_operand_add_sub_cmp_and_or_op): Likewise.
(handle_inc_and_index_mode_for_aritm_op): Likewise.
* frv-linux-tdep.c (frv_linux_pc_in_sigtramp): Add GDBARCH parameter.
(frv_linux_sigcontext_reg_addr): Pass architecture to
frv_linux_pc_in_sigtramp.
(frv_linux_sigtramp_frame_sniffer): Likewise.
* h8300-tdep.c (h8300_is_argument_spill): Add GDBARCH parameter.
(h8300_analyze_prologue): Add GDBARCH parameter. Pass to
h8300_is_argument_spill.
(h8300_frame_cache, h8300_skip_prologue): Pass architecture
to h8300_analyze_prologue.
* hppa-tdep.h (struct gdbarch_tdep): Add GDBARCH parameter to
in_solib_call_trampoline callback.
(hppa_in_solib_call_trampoline): Add GDBARCH parameter.
* hppa-tdep.c (hppa64_convert_code_addr_to_fptr): Add GDBARCH
parameter.
(hppa64_push_dummy_call): Pass architecture to
hppa64_convert_code_addr_to_fptr.
(hppa_match_insns): Add GDBARCH parameter.
(hppa_match_insns_relaxed): Add GDBARCH parameter. Pass to
hppa_match_insns.
(hppa_skip_trampoline_code): Pass architecture to hppa_match_insns.
(hppa_in_solib_call_trampoline): Add GDBARCH parameter. Pass to
hppa_match_insns_relaxed.
(hppa_stub_unwind_sniffer): Pass architecture to
tdep->in_solib_call_trampoline callback.
* hppa-hpux-tdep.c (hppa_hpux_search_pattern): Add GDBARCH parameter.
(hppa32_hpux_search_dummy_call_sequence): Pass architecture to
hppa_hpux_search_pattern.
* hppa-linux-tdep.c (insns_match_pattern): Add GDBARCH parameter.
(hppa_linux_sigtramp_find_sigcontext): Add GDBARCH parameter.
Pass to insns_match_pattern.
(hppa_linux_sigtramp_frame_unwind_cache): Pass architecture to
hppa_linux_sigtramp_find_sigcontext.
(hppa_linux_sigtramp_frame_sniffer): Likewise.
(hppa32_hpux_in_solib_call_trampoline): Add GDBARCH parameter.
(hppa64_hpux_in_solib_call_trampoline): Likewise.
* i386-tdep.c (i386_follow_jump): Add GDBARCH parameter.
(i386_analyze_frame_setup): Add GDBARCH parameter.
(i386_analyze_prologue): Add GDBARCH parameter. Pass to
i386_follow_jump and i386_analyze_frame_setup.
(i386_skip_prologue): Pass architecture to i386_analyze_prologue
and i386_follow_jump.
(i386_frame_cache): Pass architecture to i386_analyze_prologue.
(i386_pe_skip_trampoline_code): Add FRAME parameter.
* i386-tdep.h (i386_pe_skip_trampoline_code): Add FRAME parameter.
* i386-cygwin-tdep.c (i386_cygwin_skip_trampoline_code): Pass
frame to i386_pe_skip_trampoline_code.
* ia64-tdep.h (struct gdbarch_tdep): Add GDBARCH parameter
to sigcontext_register_address callback.
* ia64-tdep.c (ia64_find_global_pointer): Add GDBARCH parameter.
(ia64_find_unwind_table): Pass architecture to
ia64_find_global_pointer.
(find_extant_func_descr): Add GDBARCH parameter.
(find_func_descr): Pass architecture to find_extant_func_descr
and ia64_find_global_pointer.
(ia64_sigtramp_frame_init_saved_regs): Pass architecture to
tdep->sigcontext_register_address callback.
* ia64-linux-tdep.c (ia64_linux_sigcontext_register_address): Add
GDBARCH parameter.
* iq2000-tdep.c (iq2000_scan_prologue): Add GDBARCH parameter.
(iq2000_frame_cache): Pass architecture to iq2000_scan_prologue.
* lm32-tdep.c (lm32_analyze_prologue): Add GDBARCH parameter.
(lm32_skip_prologue, lm32_frame_cache): Pass architecture to
lm32_analyze_prologue.
* m32r-tdep.c (decode_prologue): Add GDBARCH parameter.
(m32r_skip_prologue): Pass architecture to decode_prologue.
* m68hc11-tdep.c (m68hc11_analyze_instruction): Add GDBARCH parameter.
(m68hc11_scan_prologue): Pass architecture to
m68hc11_analyze_instruction.
* m68k-tdep.c (m68k_analyze_frame_setup): Add GDBARCH parameter.
(m68k_analyze_prologue): Pass architecture to
m68k_analyze_frame_setup.
* m88k-tdep.c (m88k_fetch_instruction): Add BYTE_ORDER parameter.
(m88k_analyze_prologue): Add GDBARCH parameter. Pass byte order
to m88k_fetch_instruction.
(m88k_skip_prologue): Pass architecture to m88k_analyze_prologue.
(m88k_frame_cache): Likewise.
* mep-tdep.c (mep_get_insn): Add GDBARCH parameter.
(mep_analyze_prologue): Pass architecture to mep_get_insn.
* mips-tdep.c (mips_fetch_instruction): Add GDBARCH parameter.
(mips32_next_pc): Pass architecture to mips_fetch_instruction.
(deal_with_atomic_sequence): Likewise.
(unpack_mips16): Add GDBARCH parameter, pass to mips_fetch_instruction.
(mips16_scan_prologue): Likewise.
(mips32_scan_prologue): Likewise.
(mips16_in_function_epilogue_p): Likewise.
(mips32_in_function_epilogue_p): Likewise.
(mips_about_to_return): Likewise.
(mips_insn16_frame_cache): Pass architecture to mips16_scan_prologue.
(mips_insn32_frame_cache): Pass architecture to mips32_scan_prologue.
(mips_skip_prologue): Pass architecture to mips16_scan_prologue
and mips32_scan_prologue.
(mips_in_function_epilogue_p): Pass architecture to
mips16_in_function_epilogue_p and
mips32_in_function_epilogue_p.
(heuristic_proc_start): Pass architecture to mips_fetch_instruction
and mips_about_to_return.
(mips_skip_mips16_trampoline_code): Pass architecture to
mips_fetch_instruction.
(fetch_mips_16): Add GDBARCH parameter.
(mips16_next_pc): Pass architecture to fetch_mips_16.
(extended_mips16_next_pc): Pass architecture to unpack_mips16 and
fetch_mips_16.
* objc-lang.c (read_objc_method, read_objc_methlist_nmethods,
read_objc_methlist_method, read_objc_object, read_objc_super,
read_objc_class): Add GDBARCH parameter.
(find_implementation_from_class): Add GDBARCH parameter, pass
to read_objc_class, read_objc_methlist_nmethods, and
read_objc_methlist_method.
(find_implementation): Add GDBARCH parameter, pass to
read_objc_object and find_implementation_from_class.
(resolve_msgsend, resolve_msgsend_stret): Pass architecture
to find_implementation.
(resolve_msgsend_super, resolve_msgsend_super_stret): Pass
architecture to read_objc_super and find_implementation_from_class.
* ppc64-linux-tdep.c (ppc64_desc_entry_point): Add GDBARCH parameter.
(ppc64_standard_linkage1_target, ppc64_standard_linkage2_target,
ppc64_standard_linkage3_target): Pass architecture to
ppc64_desc_entry_point.
* rs6000-tdep.c (bl_to_blrl_insn_p): Add BYTE_ORDER parameter.
(skip_prologue): Pass byte order to bl_to_blrl_insn_p.
(rs6000_fetch_instruction): Add GDBARCH parameter.
(rs6000_skip_stack_check): Add GDBARCH parameter, pass to
rs6000_fetch_instruction.
(skip_prologue): Pass architecture to rs6000_fetch_instruction.
* remote-mips.c (mips_store_word): Return old_contents as host
integer value instead of target bytes.
* s390-tdep.c (struct s390_prologue_data): Add BYTE_ORDER member.
(s390_analyze_prologue): Initialize it.
(extend_simple_arg): Add GDBARCH parameter.
(s390_push_dummy_call): Pass architecture to extend_simple_arg.
* scm-lang.c (scm_get_field): Add BYTE_ORDER parameter.
* scm-lang.h (scm_get_field): Add BYTE_ORDER parameter.
(SCM_CAR, SCM_CDR): Pass SCM_BYTE_ORDER to scm_get_field.
* scm-valprint.c (scm_scmval_print): Likewise.
(scm_scmlist_print, scm_ipruk, scm_scmval_print): Define
SCM_BYTE_ORDER.
* sh64-tdep.c (look_for_args_moves): Add GDBARCH parameter.
(sh64_skip_prologue_hard_way): Add GDBARCH parameter, pass to
look_for_args_moves.
(sh64_skip_prologue): Pass architecture to
sh64_skip_prologue_hard_way.
* sh-tdep.c (sh_analyze_prologue): Add GDBARCH parameter.
(sh_skip_prologue): Pass architecture to sh_analyze_prologue.
(sh_frame_cache): Likewise.
* solib-irix.c (extract_mips_address): Add GDBARCH parameter.
(fetch_lm_info, irix_current_sos, irix_open_symbol_file_object):
Pass architecture to extract_mips_address.
* sparc-tdep.h (sparc_fetch_wcookie): Add GDBARCH parameter.
* sparc-tdep.c (sparc_fetch_wcookie): Add GDBARCH parameter.
(sparc_supply_rwindow, sparc_collect_rwindow): Pass architecture
to sparc_fetch_wcookie.
(sparc32_frame_prev_register): Likewise.
* sparc64-tdep.c (sparc64_frame_prev_register): Likewise.
* sparc32nbsd-tdep.c (sparc32nbsd_sigcontext_saved_regs): Likewise.
* sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_saved_regs): Likewise.
* spu-tdep.c (spu_analyze_prologue): Add GDBARCH parameter.
(spu_skip_prologue): Pass architecture to spu_analyze_prologue.
(spu_virtual_frame_pointer): Likewise.
(spu_frame_unwind_cache): Likewise.
(info_spu_mailbox_list): Add BYTE_ORER parameter.
(info_spu_mailbox_command): Pass byte order to info_spu_mailbox_list.
(info_spu_dma_cmdlist): Add BYTE_ORER parameter.
(info_spu_dma_command, info_spu_proxydma_command): Pass byte order
to info_spu_dma_cmdlist.
* symfile.c (read_target_long_array): Add GDBARCH parameter.
(simple_read_overlay_table, simple_read_overlay_region_table,
simple_overlay_update_1): Pass architecture to read_target_long_array.
* v850-tdep.c (v850_analyze_prologue): Add GDBARCH parameter.
(v850_frame_cache): Pass architecture to v850_analyze_prologue.
* xstormy16-tdep.c (xstormy16_analyze_prologue): Add GDBARCH
parameter.
(xstormy16_skip_prologue, xstormy16_frame_cache): Pass architecture
to xstormy16_analyze_prologue.
(xstormy16_resolve_jmp_table_entry): Add GDBARCH parameter.
(xstormy16_find_jmp_table_entry): Likewise.
(xstormy16_skip_trampoline_code): Pass architecture to
xstormy16_resolve_jmp_table_entry.
(xstormy16_pointer_to_address): Likewise.
(xstormy16_address_to_pointer): Pass architecture to
xstormy16_find_jmp_table_entry.
* xtensa-tdep.c (call0_track_op): Add GDBARCH parameter.
(call0_analyze_prologue): Add GDBARCH parameter, pass to
call0_track_op.
(call0_frame_cache): Pass architecture to call0_analyze_prologue.
(xtensa_skip_prologue): Likewise.
2009-07-02 Ulrich Weigand <uweigand@de.ibm.com> 2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. * defs.h (strlen_paddr, paddr, paddr_nz): Remove.

View file

@ -7922,7 +7922,8 @@ ada_value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
val = allocate_value (type1); val = allocate_value (type1);
store_unsigned_integer (value_contents_raw (val), store_unsigned_integer (value_contents_raw (val),
TYPE_LENGTH (value_type (val)), v); TYPE_LENGTH (value_type (val)),
gdbarch_byte_order (get_type_arch (type1)), v);
return val; return val;
} }

View file

@ -292,12 +292,13 @@ ada_emit_char (int c, struct type *type, struct ui_file *stream,
or 2) of a character. */ or 2) of a character. */
static int static int
char_at (const gdb_byte *string, int i, int type_len) char_at (const gdb_byte *string, int i, int type_len,
enum bfd_endian byte_order)
{ {
if (type_len == 1) if (type_len == 1)
return string[i]; return string[i];
else else
return (int) extract_unsigned_integer (string + 2 * i, 2); return (int) extract_unsigned_integer (string + 2 * i, 2, byte_order);
} }
/* Wrapper around memcpy to make it legal argument to ui_file_put */ /* Wrapper around memcpy to make it legal argument to ui_file_put */
@ -466,6 +467,7 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
unsigned int length, int force_ellipses, int type_len, unsigned int length, int force_ellipses, int type_len,
const struct value_print_options *options) const struct value_print_options *options)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (elttype));
unsigned int i; unsigned int i;
unsigned int things_printed = 0; unsigned int things_printed = 0;
int in_quotes = 0; int in_quotes = 0;
@ -496,8 +498,8 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
rep1 = i + 1; rep1 = i + 1;
reps = 1; reps = 1;
while (rep1 < length while (rep1 < length
&& char_at (string, rep1, type_len) == char_at (string, i, && char_at (string, rep1, type_len, byte_order)
type_len)) == char_at (string, i, type_len, byte_order))
{ {
rep1 += 1; rep1 += 1;
reps += 1; reps += 1;
@ -514,8 +516,8 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
in_quotes = 0; in_quotes = 0;
} }
fputs_filtered ("'", stream); fputs_filtered ("'", stream);
ada_emit_char (char_at (string, i, type_len), elttype, stream, '\'', ada_emit_char (char_at (string, i, type_len, byte_order),
type_len); elttype, stream, '\'', type_len);
fputs_filtered ("'", stream); fputs_filtered ("'", stream);
fprintf_filtered (stream, _(" <repeats %u times>"), reps); fprintf_filtered (stream, _(" <repeats %u times>"), reps);
i = rep1 - 1; i = rep1 - 1;
@ -532,8 +534,8 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string,
fputs_filtered ("\"", stream); fputs_filtered ("\"", stream);
in_quotes = 1; in_quotes = 1;
} }
ada_emit_char (char_at (string, i, type_len), elttype, stream, '"', ada_emit_char (char_at (string, i, type_len, byte_order),
type_len); elttype, stream, '"', type_len);
things_printed += 1; things_printed += 1;
} }
} }
@ -610,6 +612,7 @@ ada_val_print_array (struct type *type, const gdb_byte *valaddr,
CORE_ADDR address, struct ui_file *stream, int recurse, CORE_ADDR address, struct ui_file *stream, int recurse,
const struct value_print_options *options) const struct value_print_options *options)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
struct type *elttype = TYPE_TARGET_TYPE (type); struct type *elttype = TYPE_TARGET_TYPE (type);
unsigned int eltlen; unsigned int eltlen;
unsigned int len; unsigned int len;
@ -641,7 +644,7 @@ ada_val_print_array (struct type *type, const gdb_byte *valaddr,
for (temp_len = 0; for (temp_len = 0;
(temp_len < len (temp_len < len
&& temp_len < options->print_max && temp_len < options->print_max
&& char_at (valaddr, temp_len, eltlen) != 0); && char_at (valaddr, temp_len, eltlen, byte_order) != 0);
temp_len += 1); temp_len += 1);
len = temp_len; len = temp_len;
} }

View file

@ -44,9 +44,9 @@
*/ */
static long static long
alpha_linux_sigtramp_offset_1 (CORE_ADDR pc) alpha_linux_sigtramp_offset_1 (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
switch (alpha_read_insn (pc)) switch (alpha_read_insn (gdbarch, pc))
{ {
case 0x47de0410: /* bis $30,$30,$16 */ case 0x47de0410: /* bis $30,$30,$16 */
case 0x47fe0410: /* bis $31,$30,$16 */ case 0x47fe0410: /* bis $31,$30,$16 */
@ -66,7 +66,7 @@ alpha_linux_sigtramp_offset_1 (CORE_ADDR pc)
} }
static LONGEST static LONGEST
alpha_linux_sigtramp_offset (CORE_ADDR pc) alpha_linux_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
long i, off; long i, off;
@ -74,7 +74,7 @@ alpha_linux_sigtramp_offset (CORE_ADDR pc)
return -1; return -1;
/* Guess where we might be in the sequence. */ /* Guess where we might be in the sequence. */
off = alpha_linux_sigtramp_offset_1 (pc); off = alpha_linux_sigtramp_offset_1 (gdbarch, pc);
if (off < 0) if (off < 0)
return -1; return -1;
@ -84,7 +84,7 @@ alpha_linux_sigtramp_offset (CORE_ADDR pc)
{ {
if (i == off) if (i == off)
continue; continue;
if (alpha_linux_sigtramp_offset_1 (pc + i) != i) if (alpha_linux_sigtramp_offset_1 (gdbarch, pc + i) != i)
return -1; return -1;
} }
@ -92,14 +92,16 @@ alpha_linux_sigtramp_offset (CORE_ADDR pc)
} }
static int static int
alpha_linux_pc_in_sigtramp (CORE_ADDR pc, char *func_name) alpha_linux_pc_in_sigtramp (struct gdbarch *gdbarch,
CORE_ADDR pc, char *func_name)
{ {
return alpha_linux_sigtramp_offset (pc) >= 0; return alpha_linux_sigtramp_offset (gdbarch, pc) >= 0;
} }
static CORE_ADDR static CORE_ADDR
alpha_linux_sigcontext_addr (struct frame_info *this_frame) alpha_linux_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc; CORE_ADDR pc;
ULONGEST sp; ULONGEST sp;
long off; long off;
@ -107,7 +109,7 @@ alpha_linux_sigcontext_addr (struct frame_info *this_frame)
pc = get_frame_pc (this_frame); pc = get_frame_pc (this_frame);
sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM); sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM);
off = alpha_linux_sigtramp_offset (pc); off = alpha_linux_sigtramp_offset (gdbarch, pc);
gdb_assert (off >= 0); gdb_assert (off >= 0);
/* __NR_rt_sigreturn has a couple of structures on the stack. This is: /* __NR_rt_sigreturn has a couple of structures on the stack. This is:
@ -119,7 +121,7 @@ alpha_linux_sigcontext_addr (struct frame_info *this_frame)
offsetof (struct rt_sigframe, uc.uc_mcontext); offsetof (struct rt_sigframe, uc.uc_mcontext);
*/ */
if (alpha_read_insn (pc - off + 4) == 0x201f015f) if (alpha_read_insn (gdbarch, pc - off + 4) == 0x201f015f)
return sp + 176; return sp + 176;
/* __NR_sigreturn has the sigcontext structure at the top of the stack. */ /* __NR_sigreturn has the sigcontext structure at the top of the stack. */

View file

@ -27,7 +27,8 @@
#include "alpha-tdep.h" #include "alpha-tdep.h"
static int static int
alpha_osf1_pc_in_sigtramp (CORE_ADDR pc, char *func_name) alpha_osf1_pc_in_sigtramp (struct gdbarch *gdbarch,
CORE_ADDR pc, char *func_name)
{ {
return (func_name != NULL && strcmp ("__sigtramp", func_name) == 0); return (func_name != NULL && strcmp ("__sigtramp", func_name) == 0);
} }
@ -35,13 +36,15 @@ alpha_osf1_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
static CORE_ADDR static CORE_ADDR
alpha_osf1_sigcontext_addr (struct frame_info *this_frame) alpha_osf1_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct frame_info *next_frame = get_next_frame (this_frame); struct frame_info *next_frame = get_next_frame (this_frame);
struct frame_id next_id = null_frame_id; struct frame_id next_id = null_frame_id;
if (next_frame != NULL) if (next_frame != NULL)
next_id = get_frame_id (next_frame); next_id = get_frame_id (next_frame);
return (read_memory_integer (next_id.stack_addr, 8)); return (read_memory_integer (next_id.stack_addr, 8, byte_order));
} }
static void static void

View file

@ -154,9 +154,10 @@ alpha_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
floating point and 32-bit integers. */ floating point and 32-bit integers. */
static void static void
alpha_lds (void *out, const void *in) alpha_lds (struct gdbarch *gdbarch, void *out, const void *in)
{ {
ULONGEST mem = extract_unsigned_integer (in, 4); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST mem = extract_unsigned_integer (in, 4, byte_order);
ULONGEST frac = (mem >> 0) & 0x7fffff; ULONGEST frac = (mem >> 0) & 0x7fffff;
ULONGEST sign = (mem >> 31) & 1; ULONGEST sign = (mem >> 31) & 1;
ULONGEST exp_msb = (mem >> 30) & 1; ULONGEST exp_msb = (mem >> 30) & 1;
@ -176,20 +177,21 @@ alpha_lds (void *out, const void *in)
} }
reg = (sign << 63) | (exp << 52) | (frac << 29); reg = (sign << 63) | (exp << 52) | (frac << 29);
store_unsigned_integer (out, 8, reg); store_unsigned_integer (out, 8, byte_order, reg);
} }
/* Similarly, this represents exactly the conversion performed by /* Similarly, this represents exactly the conversion performed by
the STS instruction. */ the STS instruction. */
static void static void
alpha_sts (void *out, const void *in) alpha_sts (struct gdbarch *gdbarch, void *out, const void *in)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST reg, mem; ULONGEST reg, mem;
reg = extract_unsigned_integer (in, 8); reg = extract_unsigned_integer (in, 8, byte_order);
mem = ((reg >> 32) & 0xc0000000) | ((reg >> 29) & 0x3fffffff); mem = ((reg >> 32) & 0xc0000000) | ((reg >> 29) & 0x3fffffff);
store_unsigned_integer (out, 4, mem); store_unsigned_integer (out, 4, byte_order, mem);
} }
/* The alpha needs a conversion between register and memory format if the /* The alpha needs a conversion between register and memory format if the
@ -215,7 +217,7 @@ alpha_register_to_value (struct frame_info *frame, int regnum,
switch (TYPE_LENGTH (valtype)) switch (TYPE_LENGTH (valtype))
{ {
case 4: case 4:
alpha_sts (out, in); alpha_sts (get_frame_arch (frame), out, in);
break; break;
default: default:
error (_("Cannot retrieve value from floating point register")); error (_("Cannot retrieve value from floating point register"));
@ -231,7 +233,7 @@ alpha_value_to_register (struct frame_info *frame, int regnum,
switch (TYPE_LENGTH (valtype)) switch (TYPE_LENGTH (valtype))
{ {
case 4: case 4:
alpha_lds (out, in); alpha_lds (get_frame_arch (frame), out, in);
break; break;
default: default:
error (_("Cannot store value in floating point register")); error (_("Cannot store value in floating point register"));
@ -258,6 +260,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i; int i;
int accumulate_size = struct_return ? 8 : 0; int accumulate_size = struct_return ? 8 : 0;
struct alpha_arg struct alpha_arg
@ -408,7 +411,8 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
write_memory (sp + offset - sizeof(arg_reg_buffer), contents, len); write_memory (sp + offset - sizeof(arg_reg_buffer), contents, len);
} }
if (struct_return) if (struct_return)
store_unsigned_integer (arg_reg_buffer, ALPHA_REGISTER_SIZE, struct_addr); store_unsigned_integer (arg_reg_buffer, ALPHA_REGISTER_SIZE,
byte_order, struct_addr);
/* Load the argument registers. */ /* Load the argument registers. */
for (i = 0; i < required_arg_regs; i++) for (i = 0; i < required_arg_regs; i++)
@ -432,6 +436,8 @@ static void
alpha_extract_return_value (struct type *valtype, struct regcache *regcache, alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
gdb_byte *valbuf) gdb_byte *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int length = TYPE_LENGTH (valtype); int length = TYPE_LENGTH (valtype);
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE]; gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l; ULONGEST l;
@ -443,7 +449,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
{ {
case 4: case 4:
regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, raw_buffer); regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, raw_buffer);
alpha_sts (valbuf, raw_buffer); alpha_sts (gdbarch, valbuf, raw_buffer);
break; break;
case 8: case 8:
@ -486,7 +492,7 @@ alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
default: default:
/* Assume everything else degenerates to an integer. */ /* Assume everything else degenerates to an integer. */
regcache_cooked_read_unsigned (regcache, ALPHA_V0_REGNUM, &l); regcache_cooked_read_unsigned (regcache, ALPHA_V0_REGNUM, &l);
store_unsigned_integer (valbuf, length, l); store_unsigned_integer (valbuf, length, byte_order, l);
break; break;
} }
} }
@ -509,7 +515,7 @@ alpha_store_return_value (struct type *valtype, struct regcache *regcache,
switch (length) switch (length)
{ {
case 4: case 4:
alpha_lds (raw_buffer, valbuf); alpha_lds (gdbarch, raw_buffer, valbuf);
regcache_cooked_write (regcache, ALPHA_FP0_REGNUM, raw_buffer); regcache_cooked_write (regcache, ALPHA_FP0_REGNUM, raw_buffer);
break; break;
@ -634,15 +640,16 @@ alpha_after_prologue (CORE_ADDR pc)
/* Read an instruction from memory at PC, looking through breakpoints. */ /* Read an instruction from memory at PC, looking through breakpoints. */
unsigned int unsigned int
alpha_read_insn (CORE_ADDR pc) alpha_read_insn (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[ALPHA_INSN_SIZE]; gdb_byte buf[ALPHA_INSN_SIZE];
int status; int status;
status = target_read_memory (pc, buf, sizeof (buf)); status = target_read_memory (pc, buf, sizeof (buf));
if (status) if (status)
memory_error (status, pc); memory_error (status, pc);
return extract_unsigned_integer (buf, sizeof (buf)); return extract_unsigned_integer (buf, sizeof (buf), byte_order);
} }
/* To skip prologues, I use this predicate. Returns either PC itself /* To skip prologues, I use this predicate. Returns either PC itself
@ -686,7 +693,7 @@ alpha_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
or in the gcc frame. */ or in the gcc frame. */
for (offset = 0; offset < 100; offset += ALPHA_INSN_SIZE) for (offset = 0; offset < 100; offset += ALPHA_INSN_SIZE)
{ {
inst = alpha_read_insn (pc + offset); inst = alpha_read_insn (gdbarch, pc + offset);
if ((inst & 0xffff0000) == 0x27bb0000) /* ldah $gp,n($t12) */ if ((inst & 0xffff0000) == 0x27bb0000) /* ldah $gp,n($t12) */
continue; continue;
@ -721,7 +728,9 @@ alpha_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
static int static int
alpha_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) alpha_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame)); struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR jb_addr; CORE_ADDR jb_addr;
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE]; gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
@ -731,7 +740,7 @@ alpha_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
raw_buffer, tdep->jb_elt_size)) raw_buffer, tdep->jb_elt_size))
return 0; return 0;
*pc = extract_unsigned_integer (raw_buffer, tdep->jb_elt_size); *pc = extract_unsigned_integer (raw_buffer, tdep->jb_elt_size, byte_order);
return 1; return 1;
} }
@ -810,7 +819,7 @@ alpha_sigtramp_frame_this_id (struct frame_info *this_frame,
{ {
int offset; int offset;
code_addr = get_frame_pc (this_frame); code_addr = get_frame_pc (this_frame);
offset = tdep->dynamic_sigtramp_offset (code_addr); offset = tdep->dynamic_sigtramp_offset (gdbarch, code_addr);
if (offset >= 0) if (offset >= 0)
code_addr -= offset; code_addr -= offset;
else else
@ -876,7 +885,7 @@ alpha_sigtramp_frame_sniffer (const struct frame_unwind *self,
/* Otherwise we should be in a signal frame. */ /* Otherwise we should be in a signal frame. */
find_pc_partial_function (pc, &name, NULL, NULL); find_pc_partial_function (pc, &name, NULL, NULL);
if (gdbarch_tdep (gdbarch)->pc_in_sigtramp (pc, name)) if (gdbarch_tdep (gdbarch)->pc_in_sigtramp (gdbarch, pc, name))
return 1; return 1;
return 0; return 0;
@ -931,7 +940,7 @@ alpha_heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
nops, since this usually indicates padding between functions. */ nops, since this usually indicates padding between functions. */
for (pc -= ALPHA_INSN_SIZE; pc >= fence; pc -= ALPHA_INSN_SIZE) for (pc -= ALPHA_INSN_SIZE; pc >= fence; pc -= ALPHA_INSN_SIZE)
{ {
unsigned int insn = alpha_read_insn (pc); unsigned int insn = alpha_read_insn (gdbarch, pc);
switch (insn) switch (insn)
{ {
case 0: /* invalid insn */ case 0: /* invalid insn */
@ -1027,7 +1036,7 @@ alpha_heuristic_frame_unwind_cache (struct frame_info *this_frame,
for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += ALPHA_INSN_SIZE) for (cur_pc = start_pc; cur_pc < limit_pc; cur_pc += ALPHA_INSN_SIZE)
{ {
unsigned int word = alpha_read_insn (cur_pc); unsigned int word = alpha_read_insn (gdbarch, cur_pc);
if ((word & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */ if ((word & 0xffff0000) == 0x23de0000) /* lda $sp,n($sp) */
{ {
@ -1115,7 +1124,7 @@ alpha_heuristic_frame_unwind_cache (struct frame_info *this_frame,
{ {
while (cur_pc < (limit_pc + 80) && cur_pc < (start_pc + 80)) while (cur_pc < (limit_pc + 80) && cur_pc < (start_pc + 80))
{ {
unsigned int word = alpha_read_insn (cur_pc); unsigned int word = alpha_read_insn (gdbarch, cur_pc);
if ((word & 0xfc1f0000) == 0xb41e0000) /* stq reg,n($sp) */ if ((word & 0xfc1f0000) == 0xb41e0000) /* stq reg,n($sp) */
{ {
@ -1358,13 +1367,14 @@ fp_register_sign_bit (LONGEST reg)
static CORE_ADDR static CORE_ADDR
alpha_next_pc (struct frame_info *frame, CORE_ADDR pc) alpha_next_pc (struct frame_info *frame, CORE_ADDR pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame);
unsigned int insn; unsigned int insn;
unsigned int op; unsigned int op;
int regno; int regno;
int offset; int offset;
LONGEST rav; LONGEST rav;
insn = alpha_read_insn (pc); insn = alpha_read_insn (gdbarch, pc);
/* Opcode is top 6 bits. */ /* Opcode is top 6 bits. */
op = (insn >> 26) & 0x3f; op = (insn >> 26) & 0x3f;
@ -1401,7 +1411,7 @@ alpha_next_pc (struct frame_info *frame, CORE_ADDR pc)
case 0x33: /* FBLE */ case 0x33: /* FBLE */
case 0x32: /* FBLT */ case 0x32: /* FBLT */
case 0x35: /* FBNE */ case 0x35: /* FBNE */
regno += gdbarch_fp0_regnum (get_frame_arch (frame)); regno += gdbarch_fp0_regnum (gdbarch);
} }
rav = get_frame_register_signed (frame, regno); rav = get_frame_register_signed (frame, regno);

View file

@ -76,7 +76,7 @@ struct gdbarch_tdep
/* If PC is inside a dynamically-generated signal trampoline function /* If PC is inside a dynamically-generated signal trampoline function
(i.e. one copied onto the user stack at run-time), return how many (i.e. one copied onto the user stack at run-time), return how many
bytes PC is beyond the start of that function. Otherwise, return -1. */ bytes PC is beyond the start of that function. Otherwise, return -1. */
LONGEST (*dynamic_sigtramp_offset) (CORE_ADDR); LONGEST (*dynamic_sigtramp_offset) (struct gdbarch *, CORE_ADDR);
/* Translate a signal handler stack base address into the address of /* Translate a signal handler stack base address into the address of
the sigcontext structure for that signal handler. */ the sigcontext structure for that signal handler. */
@ -86,7 +86,7 @@ struct gdbarch_tdep
/* NOTE: cagney/2004-04-30: Do not copy/clone this code. Instead /* NOTE: cagney/2004-04-30: Do not copy/clone this code. Instead
look at tramp-frame.h and other simplier per-architecture look at tramp-frame.h and other simplier per-architecture
sigtramp unwinders. */ sigtramp unwinders. */
int (*pc_in_sigtramp) (CORE_ADDR pc, char *name); int (*pc_in_sigtramp) (struct gdbarch *gdbarch, CORE_ADDR pc, char *name);
/* If TYPE will be returned in memory, return true. */ /* If TYPE will be returned in memory, return true. */
int (*return_in_memory) (struct type *type); int (*return_in_memory) (struct type *type);
@ -102,7 +102,7 @@ struct gdbarch_tdep
size_t jb_elt_size; /* And the size of each entry in the buf. */ size_t jb_elt_size; /* And the size of each entry in the buf. */
}; };
extern unsigned int alpha_read_insn (CORE_ADDR pc); extern unsigned int alpha_read_insn (struct gdbarch *gdbarch, CORE_ADDR pc);
extern int alpha_software_single_step (struct frame_info *frame); extern int alpha_software_single_step (struct frame_info *frame);
extern CORE_ADDR alpha_after_prologue (CORE_ADDR pc); extern CORE_ADDR alpha_after_prologue (CORE_ADDR pc);

View file

@ -65,13 +65,14 @@ CORE_ADDR alphafbsd_sigtramp_start = 0x11ffff68;
CORE_ADDR alphafbsd_sigtramp_end = 0x11ffffe0; CORE_ADDR alphafbsd_sigtramp_end = 0x11ffffe0;
static int static int
alphafbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) alphafbsd_pc_in_sigtramp (struct gdbarch *gdbarch,
CORE_ADDR pc, char *func_name)
{ {
return (pc >= alphafbsd_sigtramp_start && pc < alphafbsd_sigtramp_end); return (pc >= alphafbsd_sigtramp_start && pc < alphafbsd_sigtramp_end);
} }
static LONGEST static LONGEST
alphafbsd_sigtramp_offset (CORE_ADDR pc) alphafbsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
return pc - alphafbsd_sigtramp_start; return pc - alphafbsd_sigtramp_start;
} }

View file

@ -211,7 +211,7 @@ static const unsigned char sigtramp_retcode[] =
#define RETCODE_SIZE (RETCODE_NWORDS * 4) #define RETCODE_SIZE (RETCODE_NWORDS * 4)
static LONGEST static LONGEST
alphanbsd_sigtramp_offset (CORE_ADDR pc) alphanbsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
unsigned char ret[RETCODE_SIZE], w[4]; unsigned char ret[RETCODE_SIZE], w[4];
LONGEST off; LONGEST off;
@ -241,10 +241,11 @@ alphanbsd_sigtramp_offset (CORE_ADDR pc)
} }
static int static int
alphanbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name) alphanbsd_pc_in_sigtramp (struct gdbarch *gdbarch,
CORE_ADDR pc, char *func_name)
{ {
return (nbsd_pc_in_sigtramp (pc, func_name) return (nbsd_pc_in_sigtramp (pc, func_name)
|| alphanbsd_sigtramp_offset (pc) >= 0); || alphanbsd_sigtramp_offset (gdbarch, pc) >= 0);
} }
static CORE_ADDR static CORE_ADDR

View file

@ -40,13 +40,14 @@
static const int alphaobsd_page_size = 8192; static const int alphaobsd_page_size = 8192;
static LONGEST static LONGEST
alphaobsd_sigtramp_offset (CORE_ADDR pc) alphaobsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
return (pc & (alphaobsd_page_size - 1)); return (pc & (alphaobsd_page_size - 1));
} }
static int static int
alphaobsd_pc_in_sigtramp (CORE_ADDR pc, char *name) alphaobsd_pc_in_sigtramp (struct gdbarch *gdbarch,
CORE_ADDR pc, char *name)
{ {
CORE_ADDR start_pc = (pc & ~(alphaobsd_page_size - 1)); CORE_ADDR start_pc = (pc & ~(alphaobsd_page_size - 1));
unsigned insn; unsigned insn;
@ -55,12 +56,12 @@ alphaobsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
return 0; return 0;
/* Check for "". */ /* Check for "". */
insn = alpha_read_insn (start_pc + 5 * ALPHA_INSN_SIZE); insn = alpha_read_insn (gdbarch, start_pc + 5 * ALPHA_INSN_SIZE);
if (insn != 0x201f0067) if (insn != 0x201f0067)
return 0; return 0;
/* Check for "". */ /* Check for "". */
insn = alpha_read_insn (start_pc + 6 * ALPHA_INSN_SIZE); insn = alpha_read_insn (gdbarch, start_pc + 6 * ALPHA_INSN_SIZE);
if (insn != 0x00000083) if (insn != 0x00000083)
return 0; return 0;
@ -70,14 +71,15 @@ alphaobsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
static CORE_ADDR static CORE_ADDR
alphaobsd_sigcontext_addr (struct frame_info *this_frame) alphaobsd_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR pc = get_frame_pc (this_frame);
if (alphaobsd_sigtramp_offset (pc) < 3 * ALPHA_INSN_SIZE) if (alphaobsd_sigtramp_offset (gdbarch, pc) < 3 * ALPHA_INSN_SIZE)
{ {
/* On entry, a pointer the `struct sigcontext' is passed in %a2. */ /* On entry, a pointer the `struct sigcontext' is passed in %a2. */
return get_frame_register_unsigned (this_frame, ALPHA_A0_REGNUM + 2); return get_frame_register_unsigned (this_frame, ALPHA_A0_REGNUM + 2);
} }
else if (alphaobsd_sigtramp_offset (pc) < 4 * ALPHA_INSN_SIZE) else if (alphaobsd_sigtramp_offset (gdbarch, pc) < 4 * ALPHA_INSN_SIZE)
{ {
/* It is stored on the stack Before calling the signal handler. */ /* It is stored on the stack Before calling the signal handler. */
CORE_ADDR sp; CORE_ADDR sp;

View file

@ -153,11 +153,13 @@ amd64_linux_sigtramp_p (struct frame_info *this_frame)
static CORE_ADDR static CORE_ADDR
amd64_linux_sigcontext_addr (struct frame_info *this_frame) amd64_linux_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp; CORE_ADDR sp;
gdb_byte buf[8]; gdb_byte buf[8];
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf); get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 8); sp = extract_unsigned_integer (buf, 8, byte_order);
/* The sigcontext structure is part of the user context. A pointer /* The sigcontext structure is part of the user context. A pointer
to the user context is passed as the third argument to the signal to the user context is passed as the third argument to the signal

View file

@ -677,6 +677,7 @@ amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[8]; gdb_byte buf[8];
/* Pass arguments. */ /* Pass arguments. */
@ -685,17 +686,17 @@ amd64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Pass "hidden" argument". */ /* Pass "hidden" argument". */
if (struct_return) if (struct_return)
{ {
store_unsigned_integer (buf, 8, struct_addr); store_unsigned_integer (buf, 8, byte_order, struct_addr);
regcache_cooked_write (regcache, AMD64_RDI_REGNUM, buf); regcache_cooked_write (regcache, AMD64_RDI_REGNUM, buf);
} }
/* Store return address. */ /* Store return address. */
sp -= 8; sp -= 8;
store_unsigned_integer (buf, 8, bp_addr); store_unsigned_integer (buf, 8, byte_order, bp_addr);
write_memory (sp, buf, 8); write_memory (sp, buf, 8);
/* Finally, update the stack pointer... */ /* Finally, update the stack pointer... */
store_unsigned_integer (buf, 8, sp); store_unsigned_integer (buf, 8, byte_order, sp);
regcache_cooked_write (regcache, AMD64_RSP_REGNUM, buf); regcache_cooked_write (regcache, AMD64_RSP_REGNUM, buf);
/* ...and fake a frame pointer. */ /* ...and fake a frame pointer. */
@ -1034,6 +1035,7 @@ static void
fixup_riprel (struct gdbarch *gdbarch, struct displaced_step_closure *dsc, fixup_riprel (struct gdbarch *gdbarch, struct displaced_step_closure *dsc,
CORE_ADDR from, CORE_ADDR to, struct regcache *regs) CORE_ADDR from, CORE_ADDR to, struct regcache *regs)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const struct amd64_insn *insn_details = &dsc->insn_details; const struct amd64_insn *insn_details = &dsc->insn_details;
int modrm_offset = insn_details->modrm_offset; int modrm_offset = insn_details->modrm_offset;
gdb_byte *insn = insn_details->raw_insn + modrm_offset; gdb_byte *insn = insn_details->raw_insn + modrm_offset;
@ -1047,7 +1049,7 @@ fixup_riprel (struct gdbarch *gdbarch, struct displaced_step_closure *dsc,
++insn; ++insn;
/* Compute the rip-relative address. */ /* Compute the rip-relative address. */
disp = extract_signed_integer (insn, sizeof (int32_t)); disp = extract_signed_integer (insn, sizeof (int32_t), byte_order);
insn_length = amd64_insn_length (gdbarch, dsc->insn_buf, dsc->max_len, from); insn_length = amd64_insn_length (gdbarch, dsc->insn_buf, dsc->max_len, from);
rip_base = from + insn_length; rip_base = from + insn_length;
@ -1251,6 +1253,7 @@ amd64_displaced_step_fixup (struct gdbarch *gdbarch,
CORE_ADDR from, CORE_ADDR to, CORE_ADDR from, CORE_ADDR to,
struct regcache *regs) struct regcache *regs)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* The offset we applied to the instruction's address. */ /* The offset we applied to the instruction's address. */
ULONGEST insn_offset = to - from; ULONGEST insn_offset = to - from;
gdb_byte *insn = dsc->insn_buf; gdb_byte *insn = dsc->insn_buf;
@ -1354,9 +1357,9 @@ amd64_displaced_step_fixup (struct gdbarch *gdbarch,
const ULONGEST retaddr_len = 8; const ULONGEST retaddr_len = 8;
regcache_cooked_read_unsigned (regs, AMD64_RSP_REGNUM, &rsp); regcache_cooked_read_unsigned (regs, AMD64_RSP_REGNUM, &rsp);
retaddr = read_memory_unsigned_integer (rsp, retaddr_len); retaddr = read_memory_unsigned_integer (rsp, retaddr_len, byte_order);
retaddr = (retaddr - insn_offset) & 0xffffffffUL; retaddr = (retaddr - insn_offset) & 0xffffffffUL;
write_memory_unsigned_integer (rsp, retaddr_len, retaddr); write_memory_unsigned_integer (rsp, retaddr_len, byte_order, retaddr);
if (debug_displaced) if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
@ -1589,9 +1592,11 @@ amd64_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
to have no prologue and thus no valid frame pointer in %rbp. */ to have no prologue and thus no valid frame pointer in %rbp. */
static CORE_ADDR static CORE_ADDR
amd64_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, amd64_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR pc, CORE_ADDR current_pc,
struct amd64_frame_cache *cache) struct amd64_frame_cache *cache)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
static gdb_byte proto[3] = { 0x48, 0x89, 0xe5 }; /* movq %rsp, %rbp */ static gdb_byte proto[3] = { 0x48, 0x89, 0xe5 }; /* movq %rsp, %rbp */
gdb_byte buf[3]; gdb_byte buf[3];
gdb_byte op; gdb_byte op;
@ -1601,7 +1606,7 @@ amd64_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
pc = amd64_analyze_stack_align (pc, current_pc, cache); pc = amd64_analyze_stack_align (pc, current_pc, cache);
op = read_memory_unsigned_integer (pc, 1); op = read_memory_unsigned_integer (pc, 1, byte_order);
if (op == 0x55) /* pushq %rbp */ if (op == 0x55) /* pushq %rbp */
{ {
@ -1636,7 +1641,8 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
CORE_ADDR pc; CORE_ADDR pc;
amd64_init_frame_cache (&cache); amd64_init_frame_cache (&cache);
pc = amd64_analyze_prologue (start_pc, 0xffffffffffffffffLL, &cache); pc = amd64_analyze_prologue (gdbarch, start_pc, 0xffffffffffffffffLL,
&cache);
if (cache.frameless_p) if (cache.frameless_p)
return start_pc; return start_pc;
@ -1649,6 +1655,8 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
static struct amd64_frame_cache * static struct amd64_frame_cache *
amd64_frame_cache (struct frame_info *this_frame, void **this_cache) amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct amd64_frame_cache *cache; struct amd64_frame_cache *cache;
gdb_byte buf[8]; gdb_byte buf[8];
int i; int i;
@ -1661,13 +1669,14 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->pc = get_frame_func (this_frame); cache->pc = get_frame_func (this_frame);
if (cache->pc != 0) if (cache->pc != 0)
amd64_analyze_prologue (cache->pc, get_frame_pc (this_frame), cache); amd64_analyze_prologue (gdbarch, cache->pc, get_frame_pc (this_frame),
cache);
if (cache->saved_sp_reg != -1) if (cache->saved_sp_reg != -1)
{ {
/* Stack pointer has been saved. */ /* Stack pointer has been saved. */
get_frame_register (this_frame, cache->saved_sp_reg, buf); get_frame_register (this_frame, cache->saved_sp_reg, buf);
cache->saved_sp = extract_unsigned_integer(buf, 8); cache->saved_sp = extract_unsigned_integer(buf, 8, byte_order);
} }
if (cache->frameless_p) if (cache->frameless_p)
@ -1691,13 +1700,14 @@ amd64_frame_cache (struct frame_info *this_frame, void **this_cache)
else else
{ {
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf); get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 8) + cache->sp_offset; cache->base = extract_unsigned_integer (buf, 8, byte_order)
+ cache->sp_offset;
} }
} }
else else
{ {
get_frame_register (this_frame, AMD64_RBP_REGNUM, buf); get_frame_register (this_frame, AMD64_RBP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 8); cache->base = extract_unsigned_integer (buf, 8, byte_order);
} }
/* Now that we have the base address for the stack frame we can /* Now that we have the base address for the stack frame we can
@ -1773,8 +1783,10 @@ static const struct frame_unwind amd64_frame_unwind =
static struct amd64_frame_cache * static struct amd64_frame_cache *
amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct amd64_frame_cache *cache; struct amd64_frame_cache *cache;
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
CORE_ADDR addr; CORE_ADDR addr;
gdb_byte buf[8]; gdb_byte buf[8];
int i; int i;
@ -1785,7 +1797,7 @@ amd64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
cache = amd64_alloc_frame_cache (); cache = amd64_alloc_frame_cache ();
get_frame_register (this_frame, AMD64_RSP_REGNUM, buf); get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 8) - 8; cache->base = extract_unsigned_integer (buf, 8, byte_order) - 8;
addr = tdep->sigcontext_addr (this_frame); addr = tdep->sigcontext_addr (this_frame);
gdb_assert (tdep->sc_reg_offset); gdb_assert (tdep->sc_reg_offset);

View file

@ -251,6 +251,8 @@ static void
amd64obsd_supply_uthread (struct regcache *regcache, amd64obsd_supply_uthread (struct regcache *regcache,
int regnum, CORE_ADDR addr) int regnum, CORE_ADDR addr)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp_addr = addr + AMD64OBSD_UTHREAD_RSP_OFFSET; CORE_ADDR sp_addr = addr + AMD64OBSD_UTHREAD_RSP_OFFSET;
CORE_ADDR sp = 0; CORE_ADDR sp = 0;
gdb_byte buf[8]; gdb_byte buf[8];
@ -263,12 +265,12 @@ amd64obsd_supply_uthread (struct regcache *regcache,
int offset; int offset;
/* Fetch stack pointer from thread structure. */ /* Fetch stack pointer from thread structure. */
sp = read_memory_unsigned_integer (sp_addr, 8); sp = read_memory_unsigned_integer (sp_addr, 8, byte_order);
/* Adjust the stack pointer such that it looks as if we just /* Adjust the stack pointer such that it looks as if we just
returned from _thread_machdep_switch. */ returned from _thread_machdep_switch. */
offset = amd64obsd_uthread_reg_offset[AMD64_RIP_REGNUM] + 8; offset = amd64obsd_uthread_reg_offset[AMD64_RIP_REGNUM] + 8;
store_unsigned_integer (buf, 8, sp + offset); store_unsigned_integer (buf, 8, byte_order, sp + offset);
regcache_raw_supply (regcache, AMD64_RSP_REGNUM, buf); regcache_raw_supply (regcache, AMD64_RSP_REGNUM, buf);
} }
@ -280,7 +282,7 @@ amd64obsd_supply_uthread (struct regcache *regcache,
/* Fetch stack pointer from thread structure (if we didn't /* Fetch stack pointer from thread structure (if we didn't
do so already). */ do so already). */
if (sp == 0) if (sp == 0)
sp = read_memory_unsigned_integer (sp_addr, 8); sp = read_memory_unsigned_integer (sp_addr, 8, byte_order);
/* Read the saved register from the stack frame. */ /* Read the saved register from the stack frame. */
read_memory (sp + amd64obsd_uthread_reg_offset[i], buf, 8); read_memory (sp + amd64obsd_uthread_reg_offset[i], buf, 8);
@ -293,6 +295,8 @@ static void
amd64obsd_collect_uthread (const struct regcache *regcache, amd64obsd_collect_uthread (const struct regcache *regcache,
int regnum, CORE_ADDR addr) int regnum, CORE_ADDR addr)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp_addr = addr + AMD64OBSD_UTHREAD_RSP_OFFSET; CORE_ADDR sp_addr = addr + AMD64OBSD_UTHREAD_RSP_OFFSET;
CORE_ADDR sp = 0; CORE_ADDR sp = 0;
gdb_byte buf[8]; gdb_byte buf[8];
@ -308,10 +312,10 @@ amd64obsd_collect_uthread (const struct regcache *regcache,
stored into the thread structure. */ stored into the thread structure. */
offset = amd64obsd_uthread_reg_offset[AMD64_RIP_REGNUM] + 8; offset = amd64obsd_uthread_reg_offset[AMD64_RIP_REGNUM] + 8;
regcache_raw_collect (regcache, AMD64_RSP_REGNUM, buf); regcache_raw_collect (regcache, AMD64_RSP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 8) - offset; sp = extract_unsigned_integer (buf, 8, byte_order) - offset;
/* Store the stack pointer. */ /* Store the stack pointer. */
write_memory_unsigned_integer (sp_addr, 8, sp); write_memory_unsigned_integer (sp_addr, 8, byte_order, sp);
/* The stack pointer was (potentially) modified. Make sure we /* The stack pointer was (potentially) modified. Make sure we
build a proper stack frame. */ build a proper stack frame. */
@ -326,7 +330,7 @@ amd64obsd_collect_uthread (const struct regcache *regcache,
/* Fetch stack pointer from thread structure (if we didn't /* Fetch stack pointer from thread structure (if we didn't
calculate it already). */ calculate it already). */
if (sp == 0) if (sp == 0)
sp = read_memory_unsigned_integer (sp_addr, 8); sp = read_memory_unsigned_integer (sp_addr, 8, byte_order);
/* Write the register into the stack frame. */ /* Write the register into the stack frame. */
regcache_raw_collect (regcache, i, buf); regcache_raw_collect (regcache, i, buf);
@ -343,6 +347,8 @@ amd64obsd_collect_uthread (const struct regcache *regcache,
static struct trad_frame_cache * static struct trad_frame_cache *
amd64obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache) amd64obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct trad_frame_cache *cache; struct trad_frame_cache *cache;
CORE_ADDR func, sp, addr; CORE_ADDR func, sp, addr;
ULONGEST cs; ULONGEST cs;
@ -370,7 +376,7 @@ amd64obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
/* Read %cs from trap frame. */ /* Read %cs from trap frame. */
addr += amd64obsd_tf_reg_offset[AMD64_CS_REGNUM]; addr += amd64obsd_tf_reg_offset[AMD64_CS_REGNUM];
cs = read_memory_unsigned_integer (addr, 8); cs = read_memory_unsigned_integer (addr, 8, byte_order);
if ((cs & I386_SEL_RPL) == I386_SEL_UPL) if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
{ {
/* Trap from user space; terminate backtrace. */ /* Trap from user space; terminate backtrace. */

View file

@ -118,7 +118,8 @@ generic_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
} }
int int
generic_in_solib_return_trampoline (CORE_ADDR pc, char *name) generic_in_solib_return_trampoline (struct gdbarch *gdbarch,
CORE_ADDR pc, char *name)
{ {
return 0; return 0;
} }

View file

@ -92,7 +92,8 @@ extern CORE_ADDR generic_skip_trampoline_code (struct frame_info *frame,
extern CORE_ADDR generic_skip_solib_resolver (struct gdbarch *gdbarch, extern CORE_ADDR generic_skip_solib_resolver (struct gdbarch *gdbarch,
CORE_ADDR pc); CORE_ADDR pc);
extern int generic_in_solib_return_trampoline (CORE_ADDR pc, char *name); extern int generic_in_solib_return_trampoline (struct gdbarch *gdbarch,
CORE_ADDR pc, char *name);
extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc); extern int generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc);

View file

@ -284,8 +284,10 @@ arm_linux_sigreturn_init (const struct tramp_frame *self,
struct trad_frame_cache *this_cache, struct trad_frame_cache *this_cache,
CORE_ADDR func) CORE_ADDR func)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM); CORE_ADDR sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
ULONGEST uc_flags = read_memory_unsigned_integer (sp, 4); ULONGEST uc_flags = read_memory_unsigned_integer (sp, 4, byte_order);
if (uc_flags == ARM_NEW_SIGFRAME_MAGIC) if (uc_flags == ARM_NEW_SIGFRAME_MAGIC)
arm_linux_sigtramp_cache (this_frame, this_cache, func, arm_linux_sigtramp_cache (this_frame, this_cache, func,
@ -302,8 +304,10 @@ arm_linux_rt_sigreturn_init (const struct tramp_frame *self,
struct trad_frame_cache *this_cache, struct trad_frame_cache *this_cache,
CORE_ADDR func) CORE_ADDR func)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM); CORE_ADDR sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
ULONGEST pinfo = read_memory_unsigned_integer (sp, 4); ULONGEST pinfo = read_memory_unsigned_integer (sp, 4, byte_order);
if (pinfo == sp + ARM_OLD_RT_SIGFRAME_SIGINFO) if (pinfo == sp + ARM_OLD_RT_SIGFRAME_SIGINFO)
arm_linux_sigtramp_cache (this_frame, this_cache, func, arm_linux_sigtramp_cache (this_frame, this_cache, func,
@ -368,6 +372,8 @@ arm_linux_supply_gregset (const struct regset *regset,
struct regcache *regcache, struct regcache *regcache,
int regnum, const void *gregs_buf, size_t len) int regnum, const void *gregs_buf, size_t len)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const gdb_byte *gregs = gregs_buf; const gdb_byte *gregs = gregs_buf;
int regno; int regno;
CORE_ADDR reg_pc; CORE_ADDR reg_pc;
@ -392,9 +398,9 @@ arm_linux_supply_gregset (const struct regset *regset,
{ {
reg_pc = extract_unsigned_integer (gregs reg_pc = extract_unsigned_integer (gregs
+ INT_REGISTER_SIZE * ARM_PC_REGNUM, + INT_REGISTER_SIZE * ARM_PC_REGNUM,
INT_REGISTER_SIZE); INT_REGISTER_SIZE, byte_order);
reg_pc = gdbarch_addr_bits_remove (get_regcache_arch (regcache), reg_pc); reg_pc = gdbarch_addr_bits_remove (gdbarch, reg_pc);
store_unsigned_integer (pc_buf, INT_REGISTER_SIZE, reg_pc); store_unsigned_integer (pc_buf, INT_REGISTER_SIZE, byte_order, reg_pc);
regcache_raw_supply (regcache, ARM_PC_REGNUM, pc_buf); regcache_raw_supply (regcache, ARM_PC_REGNUM, pc_buf);
} }
} }

View file

@ -68,19 +68,6 @@ static int arm_debug;
#define MSYMBOL_IS_SPECIAL(msym) \ #define MSYMBOL_IS_SPECIAL(msym) \
MSYMBOL_TARGET_FLAG_1 (msym) MSYMBOL_TARGET_FLAG_1 (msym)
/* Macros for swapping shorts and ints. In the unlikely case that anybody else needs these,
move to a general header. (A better solution might be to define memory read routines that
know whether they are reading code or data.) */
#define SWAP_SHORT(x) \
((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8));
#define SWAP_INT(x) \
( ((x & 0xff000000) >> 24) \
| ((x & 0x00ff0000) >> 8) \
| ((x & 0x0000ff00) << 8) \
| ((x & 0x000000ff) << 24))
/* Per-objfile data used for mapping symbols. */ /* Per-objfile data used for mapping symbols. */
static const struct objfile_data *arm_objfile_data_key; static const struct objfile_data *arm_objfile_data_key;
@ -387,6 +374,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR start, CORE_ADDR limit, CORE_ADDR start, CORE_ADDR limit,
struct arm_prologue_cache *cache) struct arm_prologue_cache *cache)
{ {
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
int i; int i;
pv_t regs[16]; pv_t regs[16];
struct pv_area *stack; struct pv_area *stack;
@ -402,10 +390,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
{ {
unsigned short insn; unsigned short insn;
insn = read_memory_unsigned_integer (start, 2); insn = read_memory_unsigned_integer (start, 2, byte_order_for_code);
if (gdbarch_byte_order_for_code (gdbarch) != gdbarch_byte_order (gdbarch))
insn = SWAP_SHORT (insn);
if ((insn & 0xfe00) == 0xb400) /* push { rlist } */ if ((insn & 0xfe00) == 0xb400) /* push { rlist } */
{ {
@ -533,6 +518,7 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
static CORE_ADDR static CORE_ADDR
arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
unsigned long inst; unsigned long inst;
CORE_ADDR skip_pc; CORE_ADDR skip_pc;
CORE_ADDR func_addr, limit_pc; CORE_ADDR func_addr, limit_pc;
@ -571,10 +557,7 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
for (skip_pc = pc; skip_pc < limit_pc; skip_pc += 4) for (skip_pc = pc; skip_pc < limit_pc; skip_pc += 4)
{ {
inst = read_memory_unsigned_integer (skip_pc, 4); inst = read_memory_unsigned_integer (skip_pc, 4, byte_order_for_code);
if (gdbarch_byte_order_for_code (gdbarch) != gdbarch_byte_order (gdbarch))
inst = SWAP_INT (inst);
/* "mov ip, sp" is no longer a required part of the prologue. */ /* "mov ip, sp" is no longer a required part of the prologue. */
if (inst == 0xe1a0c00d) /* mov ip, sp */ if (inst == 0xe1a0c00d) /* mov ip, sp */
@ -754,6 +737,8 @@ arm_scan_prologue (struct frame_info *this_frame,
struct arm_prologue_cache *cache) struct arm_prologue_cache *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_for_code = gdbarch_byte_order_for_code (gdbarch);
int regno; int regno;
CORE_ADDR prologue_start, prologue_end, current_pc; CORE_ADDR prologue_start, prologue_end, current_pc;
CORE_ADDR prev_pc = get_frame_pc (this_frame); CORE_ADDR prev_pc = get_frame_pc (this_frame);
@ -827,7 +812,7 @@ arm_scan_prologue (struct frame_info *this_frame,
LONGEST return_value; LONGEST return_value;
frame_loc = get_frame_register_unsigned (this_frame, ARM_FP_REGNUM); frame_loc = get_frame_register_unsigned (this_frame, ARM_FP_REGNUM);
if (!safe_read_memory_integer (frame_loc, 4, &return_value)) if (!safe_read_memory_integer (frame_loc, 4, byte_order, &return_value))
return; return;
else else
{ {
@ -870,10 +855,8 @@ arm_scan_prologue (struct frame_info *this_frame,
current_pc < prologue_end; current_pc < prologue_end;
current_pc += 4) current_pc += 4)
{ {
unsigned int insn = read_memory_unsigned_integer (current_pc, 4); unsigned int insn
= read_memory_unsigned_integer (current_pc, 4, byte_order_for_code);
if (gdbarch_byte_order_for_code (gdbarch) != gdbarch_byte_order (gdbarch))
insn = SWAP_INT (insn);
if (insn == 0xe1a0c00d) /* mov ip, sp */ if (insn == 0xe1a0c00d) /* mov ip, sp */
{ {
@ -1400,6 +1383,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value **args, CORE_ADDR sp, int struct_return, struct value **args, CORE_ADDR sp, int struct_return,
CORE_ADDR struct_addr) CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int argnum; int argnum;
int argreg; int argreg;
int nstack; int nstack;
@ -1481,11 +1465,12 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
&& target_type != NULL && target_type != NULL
&& TYPE_CODE_FUNC == TYPE_CODE (target_type)) && TYPE_CODE_FUNC == TYPE_CODE (target_type))
{ {
CORE_ADDR regval = extract_unsigned_integer (val, len); CORE_ADDR regval = extract_unsigned_integer (val, len, byte_order);
if (arm_pc_is_thumb (regval)) if (arm_pc_is_thumb (regval))
{ {
val = alloca (len); val = alloca (len);
store_unsigned_integer (val, len, MAKE_THUMB_ADDR (regval)); store_unsigned_integer (val, len, byte_order,
MAKE_THUMB_ADDR (regval));
} }
} }
@ -1500,8 +1485,9 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
/* The argument is being passed in a general purpose /* The argument is being passed in a general purpose
register. */ register. */
CORE_ADDR regval = extract_unsigned_integer (val, partial_len); CORE_ADDR regval
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) = extract_unsigned_integer (val, partial_len, byte_order);
if (byte_order == BFD_ENDIAN_BIG)
regval <<= (INT_REGISTER_SIZE - partial_len) * 8; regval <<= (INT_REGISTER_SIZE - partial_len) * 8;
if (arm_debug) if (arm_debug)
fprintf_unfiltered (gdb_stdlog, "arg %d in %s = 0x%s\n", fprintf_unfiltered (gdb_stdlog, "arg %d in %s = 0x%s\n",
@ -1843,13 +1829,14 @@ static CORE_ADDR
thumb_get_next_pc (struct frame_info *frame, CORE_ADDR pc) thumb_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
unsigned long pc_val = ((unsigned long) pc) + 4; /* PC after prefetch */ unsigned long pc_val = ((unsigned long) pc) + 4; /* PC after prefetch */
unsigned short inst1 = read_memory_unsigned_integer (pc, 2); unsigned short inst1;
CORE_ADDR nextpc = pc + 2; /* default is next instruction */ CORE_ADDR nextpc = pc + 2; /* default is next instruction */
unsigned long offset; unsigned long offset;
if (gdbarch_byte_order_for_code (gdbarch) != gdbarch_byte_order (gdbarch)) inst1 = read_memory_unsigned_integer (pc, 2, byte_order_for_code);
inst1 = SWAP_SHORT (inst1);
if ((inst1 & 0xff00) == 0xbd00) /* pop {rlist, pc} */ if ((inst1 & 0xff00) == 0xbd00) /* pop {rlist, pc} */
{ {
@ -1859,7 +1846,7 @@ thumb_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
all of the other registers. */ all of the other registers. */
offset = bitcount (bits (inst1, 0, 7)) * INT_REGISTER_SIZE; offset = bitcount (bits (inst1, 0, 7)) * INT_REGISTER_SIZE;
sp = get_frame_register_unsigned (frame, ARM_SP_REGNUM); sp = get_frame_register_unsigned (frame, ARM_SP_REGNUM);
nextpc = (CORE_ADDR) read_memory_unsigned_integer (sp + offset, 4); nextpc = read_memory_unsigned_integer (sp + offset, 4, byte_order);
nextpc = gdbarch_addr_bits_remove (gdbarch, nextpc); nextpc = gdbarch_addr_bits_remove (gdbarch, nextpc);
if (nextpc == pc) if (nextpc == pc)
error (_("Infinite loop detected")); error (_("Infinite loop detected"));
@ -1877,9 +1864,8 @@ thumb_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
} }
else if ((inst1 & 0xf800) == 0xf000) /* long branch with link, and blx */ else if ((inst1 & 0xf800) == 0xf000) /* long branch with link, and blx */
{ {
unsigned short inst2 = read_memory_unsigned_integer (pc + 2, 2); unsigned short inst2;
if (gdbarch_byte_order_for_code (gdbarch) != gdbarch_byte_order (gdbarch)) inst2 = read_memory_unsigned_integer (pc + 2, 2, byte_order_for_code);
inst2 = SWAP_SHORT (inst2);
offset = (sbits (inst1, 0, 10) << 12) + (bits (inst2, 0, 10) << 1); offset = (sbits (inst1, 0, 10) << 12) + (bits (inst2, 0, 10) << 1);
nextpc = pc_val + offset; nextpc = pc_val + offset;
/* For BLX make sure to clear the low bits. */ /* For BLX make sure to clear the low bits. */
@ -1905,6 +1891,8 @@ CORE_ADDR
arm_get_next_pc (struct frame_info *frame, CORE_ADDR pc) arm_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
unsigned long pc_val; unsigned long pc_val;
unsigned long this_instr; unsigned long this_instr;
unsigned long status; unsigned long status;
@ -1914,10 +1902,7 @@ arm_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
return thumb_get_next_pc (frame, pc); return thumb_get_next_pc (frame, pc);
pc_val = (unsigned long) pc; pc_val = (unsigned long) pc;
this_instr = read_memory_unsigned_integer (pc, 4); this_instr = read_memory_unsigned_integer (pc, 4, byte_order_for_code);
if (gdbarch_byte_order_for_code (gdbarch) != gdbarch_byte_order (gdbarch))
this_instr = SWAP_INT (this_instr);
status = get_frame_register_unsigned (frame, ARM_PS_REGNUM); status = get_frame_register_unsigned (frame, ARM_PS_REGNUM);
nextpc = (CORE_ADDR) (pc_val + 4); /* Default case */ nextpc = (CORE_ADDR) (pc_val + 4); /* Default case */
@ -2098,7 +2083,7 @@ arm_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
base -= offset; base -= offset;
} }
nextpc = (CORE_ADDR) read_memory_integer ((CORE_ADDR) base, nextpc = (CORE_ADDR) read_memory_integer ((CORE_ADDR) base,
4); 4, byte_order);
nextpc = gdbarch_addr_bits_remove (gdbarch, nextpc); nextpc = gdbarch_addr_bits_remove (gdbarch, nextpc);
@ -2136,7 +2121,7 @@ arm_get_next_pc (struct frame_info *frame, CORE_ADDR pc)
nextpc = nextpc =
(CORE_ADDR) read_memory_integer ((CORE_ADDR) (rn_val (CORE_ADDR) read_memory_integer ((CORE_ADDR) (rn_val
+ offset), + offset),
4); 4, byte_order);
} }
nextpc = gdbarch_addr_bits_remove nextpc = gdbarch_addr_bits_remove
(gdbarch, nextpc); (gdbarch, nextpc);
@ -2309,6 +2294,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
gdb_byte *valbuf) gdb_byte *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regs); struct gdbarch *gdbarch = get_regcache_arch (regs);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (TYPE_CODE_FLT == TYPE_CODE (type)) if (TYPE_CODE_FLT == TYPE_CODE (type))
{ {
@ -2363,7 +2349,7 @@ arm_extract_return_value (struct type *type, struct regcache *regs,
store_unsigned_integer (valbuf, store_unsigned_integer (valbuf,
(len > INT_REGISTER_SIZE (len > INT_REGISTER_SIZE
? INT_REGISTER_SIZE : len), ? INT_REGISTER_SIZE : len),
tmp); byte_order, tmp);
len -= INT_REGISTER_SIZE; len -= INT_REGISTER_SIZE;
valbuf += INT_REGISTER_SIZE; valbuf += INT_REGISTER_SIZE;
} }
@ -2498,6 +2484,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
const gdb_byte *valbuf) const gdb_byte *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regs); struct gdbarch *gdbarch = get_regcache_arch (regs);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (TYPE_CODE (type) == TYPE_CODE_FLT) if (TYPE_CODE (type) == TYPE_CODE_FLT)
{ {
@ -2541,7 +2528,7 @@ arm_store_return_value (struct type *type, struct regcache *regs,
bfd_byte tmpbuf[INT_REGISTER_SIZE]; bfd_byte tmpbuf[INT_REGISTER_SIZE];
LONGEST val = unpack_long (type, valbuf); LONGEST val = unpack_long (type, valbuf);
store_signed_integer (tmpbuf, INT_REGISTER_SIZE, val); store_signed_integer (tmpbuf, INT_REGISTER_SIZE, byte_order, val);
regcache_cooked_write (regs, ARM_A1_REGNUM, tmpbuf); regcache_cooked_write (regs, ARM_A1_REGNUM, tmpbuf);
} }
else else
@ -2612,9 +2599,11 @@ arm_return_value (struct gdbarch *gdbarch, struct type *func_type,
static int static int
arm_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) arm_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR jb_addr; CORE_ADDR jb_addr;
char buf[INT_REGISTER_SIZE]; char buf[INT_REGISTER_SIZE];
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame));
jb_addr = get_frame_register_unsigned (frame, ARM_A1_REGNUM); jb_addr = get_frame_register_unsigned (frame, ARM_A1_REGNUM);
@ -2622,7 +2611,7 @@ arm_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
INT_REGISTER_SIZE)) INT_REGISTER_SIZE))
return 0; return 0;
*pc = extract_unsigned_integer (buf, INT_REGISTER_SIZE); *pc = extract_unsigned_integer (buf, INT_REGISTER_SIZE, byte_order);
return 1; return 1;
} }

View file

@ -24,6 +24,7 @@
#include "target.h" #include "target.h"
#include "solib.h" #include "solib.h"
#include "solib-target.h" #include "solib-target.h"
#include "frame.h"
#include "gdb_string.h" #include "gdb_string.h"
@ -39,6 +40,8 @@ static const char arm_wince_thumb_le_breakpoint[] = { 0xfe, 0xdf };
static CORE_ADDR static CORE_ADDR
arm_pe_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) arm_pe_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST indirect; ULONGEST indirect;
struct minimal_symbol *indsym; struct minimal_symbol *indsym;
char *symname; char *symname;
@ -50,11 +53,11 @@ arm_pe_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
.dw __imp_<func> */ .dw __imp_<func> */
if (pc == 0 if (pc == 0
|| read_memory_unsigned_integer (pc + 0, 4) != 0xe59fc000 || read_memory_unsigned_integer (pc + 0, 4, byte_order) != 0xe59fc000
|| read_memory_unsigned_integer (pc + 4, 4) != 0xe59cf000) || read_memory_unsigned_integer (pc + 4, 4, byte_order) != 0xe59cf000)
return 0; return 0;
indirect = read_memory_unsigned_integer (pc + 8, 4); indirect = read_memory_unsigned_integer (pc + 8, 4, byte_order);
if (indirect == 0) if (indirect == 0)
return 0; return 0;
@ -66,7 +69,7 @@ arm_pe_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
if (symname == NULL || strncmp (symname, "__imp_", 6) != 0) if (symname == NULL || strncmp (symname, "__imp_", 6) != 0)
return 0; return 0;
next_pc = read_memory_unsigned_integer (indirect, 4); next_pc = read_memory_unsigned_integer (indirect, 4, byte_order);
if (next_pc != 0) if (next_pc != 0)
return next_pc; return next_pc;

View file

@ -82,6 +82,7 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
{ {
const int sizeof_auxv_field = gdbarch_ptr_bit (target_gdbarch) const int sizeof_auxv_field = gdbarch_ptr_bit (target_gdbarch)
/ TARGET_CHAR_BIT; / TARGET_CHAR_BIT;
const enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
gdb_byte *ptr = *readptr; gdb_byte *ptr = *readptr;
if (endptr == ptr) if (endptr == ptr)
@ -90,9 +91,9 @@ default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
if (endptr - ptr < sizeof_auxv_field * 2) if (endptr - ptr < sizeof_auxv_field * 2)
return -1; return -1;
*typep = extract_unsigned_integer (ptr, sizeof_auxv_field); *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
ptr += sizeof_auxv_field; ptr += sizeof_auxv_field;
*valp = extract_unsigned_integer (ptr, sizeof_auxv_field); *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
ptr += sizeof_auxv_field; ptr += sizeof_auxv_field;
*readptr = ptr; *readptr = ptr;

View file

@ -72,9 +72,6 @@
#undef XMALLOC #undef XMALLOC
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
#undef EXTRACT_INSN
#define EXTRACT_INSN(addr) extract_unsigned_integer(addr,2)
/* Constants: prefixed with AVR_ to avoid name space clashes */ /* Constants: prefixed with AVR_ to avoid name space clashes */
enum enum
@ -282,17 +279,19 @@ static void
avr_address_to_pointer (struct gdbarch *gdbarch, avr_address_to_pointer (struct gdbarch *gdbarch,
struct type *type, gdb_byte *buf, CORE_ADDR addr) struct type *type, gdb_byte *buf, CORE_ADDR addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Is it a code address? */ /* Is it a code address? */
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
|| TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD) || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
{ {
store_unsigned_integer (buf, TYPE_LENGTH (type), store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
avr_convert_iaddr_to_raw (addr >> 1)); avr_convert_iaddr_to_raw (addr >> 1));
} }
else else
{ {
/* Strip off any upper segment bits. */ /* Strip off any upper segment bits. */
store_unsigned_integer (buf, TYPE_LENGTH (type), store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order,
avr_convert_saddr_to_raw (addr)); avr_convert_saddr_to_raw (addr));
} }
} }
@ -301,7 +300,9 @@ static CORE_ADDR
avr_pointer_to_address (struct gdbarch *gdbarch, avr_pointer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf) struct type *type, const gdb_byte *buf)
{ {
CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR addr
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
/* Is it a code address? */ /* Is it a code address? */
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
@ -423,9 +424,10 @@ avr_write_pc (struct regcache *regcache, CORE_ADDR val)
types. */ types. */
static CORE_ADDR static CORE_ADDR
avr_scan_prologue (CORE_ADDR pc_beg, CORE_ADDR pc_end, avr_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc_beg, CORE_ADDR pc_end,
struct avr_unwind_cache *info) struct avr_unwind_cache *info)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i; int i;
unsigned short insn; unsigned short insn;
int scan_stage = 0; int scan_stage = 0;
@ -458,12 +460,12 @@ avr_scan_prologue (CORE_ADDR pc_beg, CORE_ADDR pc_end,
0xcd, 0xbf /* out __SP_L__,r28 */ 0xcd, 0xbf /* out __SP_L__,r28 */
}; };
insn = EXTRACT_INSN (&prologue[vpc]); insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
/* ldi r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>) */ /* ldi r28,lo8(<RAM_ADDR> - <LOCALS_SIZE>) */
if ((insn & 0xf0f0) == 0xe0c0) if ((insn & 0xf0f0) == 0xe0c0)
{ {
locals = (insn & 0xf) | ((insn & 0x0f00) >> 4); locals = (insn & 0xf) | ((insn & 0x0f00) >> 4);
insn = EXTRACT_INSN (&prologue[vpc + 2]); insn = extract_unsigned_integer (&prologue[vpc + 2], 2, byte_order);
/* ldi r29,hi8(<RAM_ADDR> - <LOCALS_SIZE>) */ /* ldi r29,hi8(<RAM_ADDR> - <LOCALS_SIZE>) */
if ((insn & 0xf0f0) == 0xe0d0) if ((insn & 0xf0f0) == 0xe0d0)
{ {
@ -494,28 +496,28 @@ avr_scan_prologue (CORE_ADDR pc_beg, CORE_ADDR pc_end,
if (len < 10) if (len < 10)
break; break;
insn = EXTRACT_INSN (&prologue[vpc]); insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
/* ldi r26,<LOCALS_SIZE> */ /* ldi r26,<LOCALS_SIZE> */
if ((insn & 0xf0f0) != 0xe0a0) if ((insn & 0xf0f0) != 0xe0a0)
break; break;
loc_size = (insn & 0xf) | ((insn & 0x0f00) >> 4); loc_size = (insn & 0xf) | ((insn & 0x0f00) >> 4);
pc_offset += 2; pc_offset += 2;
insn = EXTRACT_INSN (&prologue[vpc + 2]); insn = extract_unsigned_integer (&prologue[vpc + 2], 2, byte_order);
/* ldi r27,<LOCALS_SIZE> / 256 */ /* ldi r27,<LOCALS_SIZE> / 256 */
if ((insn & 0xf0f0) != 0xe0b0) if ((insn & 0xf0f0) != 0xe0b0)
break; break;
loc_size |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8; loc_size |= ((insn & 0xf) | ((insn & 0x0f00) >> 4)) << 8;
pc_offset += 2; pc_offset += 2;
insn = EXTRACT_INSN (&prologue[vpc + 4]); insn = extract_unsigned_integer (&prologue[vpc + 4], 2, byte_order);
/* ldi r30,pm_lo8(.L_foo_body) */ /* ldi r30,pm_lo8(.L_foo_body) */
if ((insn & 0xf0f0) != 0xe0e0) if ((insn & 0xf0f0) != 0xe0e0)
break; break;
body_addr = (insn & 0xf) | ((insn & 0x0f00) >> 4); body_addr = (insn & 0xf) | ((insn & 0x0f00) >> 4);
pc_offset += 2; pc_offset += 2;
insn = EXTRACT_INSN (&prologue[vpc + 6]); insn = extract_unsigned_integer (&prologue[vpc + 6], 2, byte_order);
/* ldi r31,pm_hi8(.L_foo_body) */ /* ldi r31,pm_hi8(.L_foo_body) */
if ((insn & 0xf0f0) != 0xe0f0) if ((insn & 0xf0f0) != 0xe0f0)
break; break;
@ -526,7 +528,7 @@ avr_scan_prologue (CORE_ADDR pc_beg, CORE_ADDR pc_end,
if (!msymbol) if (!msymbol)
break; break;
insn = EXTRACT_INSN (&prologue[vpc + 8]); insn = extract_unsigned_integer (&prologue[vpc + 8], 2, byte_order);
/* rjmp __prologue_saves__+RRR */ /* rjmp __prologue_saves__+RRR */
if ((insn & 0xf000) == 0xc000) if ((insn & 0xf000) == 0xc000)
{ {
@ -546,7 +548,8 @@ avr_scan_prologue (CORE_ADDR pc_beg, CORE_ADDR pc_end,
{ {
/* Extract absolute PC address from JMP */ /* Extract absolute PC address from JMP */
i = (((insn & 0x1) | ((insn & 0x1f0) >> 3) << 16) i = (((insn & 0x1) | ((insn & 0x1f0) >> 3) << 16)
| (EXTRACT_INSN (&prologue[vpc + 10]) & 0xffff)); | (extract_unsigned_integer (&prologue[vpc + 10], 2, byte_order)
& 0xffff));
/* Convert address to byte addressable mode */ /* Convert address to byte addressable mode */
i *= 2; i *= 2;
@ -630,7 +633,7 @@ avr_scan_prologue (CORE_ADDR pc_beg, CORE_ADDR pc_end,
for (; vpc < len; vpc += 2) for (; vpc < len; vpc += 2)
{ {
insn = EXTRACT_INSN (&prologue[vpc]); insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
if ((insn & 0xfe0f) == 0x920f) /* push rXX */ if ((insn & 0xfe0f) == 0x920f) /* push rXX */
{ {
/* Bits 4-9 contain a mask for registers R0-R32. */ /* Bits 4-9 contain a mask for registers R0-R32. */
@ -699,14 +702,14 @@ avr_scan_prologue (CORE_ADDR pc_beg, CORE_ADDR pc_end,
0xcd, 0xbf /* out 0x3d,r28 ; SPL */ 0xcd, 0xbf /* out 0x3d,r28 ; SPL */
}; };
insn = EXTRACT_INSN (&prologue[vpc]); insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
vpc += 2; vpc += 2;
if ((insn & 0xff30) == 0x9720) /* sbiw r28,XXX */ if ((insn & 0xff30) == 0x9720) /* sbiw r28,XXX */
locals_size = (insn & 0xf) | ((insn & 0xc0) >> 2); locals_size = (insn & 0xf) | ((insn & 0xc0) >> 2);
else if ((insn & 0xf0f0) == 0x50c0) /* subi r28,lo8(XX) */ else if ((insn & 0xf0f0) == 0x50c0) /* subi r28,lo8(XX) */
{ {
locals_size = (insn & 0xf) | ((insn & 0xf00) >> 4); locals_size = (insn & 0xf) | ((insn & 0xf00) >> 4);
insn = EXTRACT_INSN (&prologue[vpc]); insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
vpc += 2; vpc += 2;
locals_size += ((insn & 0xf) | ((insn & 0xf00) >> 4) << 8); locals_size += ((insn & 0xf) | ((insn & 0xf00) >> 4) << 8);
} }
@ -744,7 +747,7 @@ avr_scan_prologue (CORE_ADDR pc_beg, CORE_ADDR pc_end,
for (; vpc < len; vpc += 2) for (; vpc < len; vpc += 2)
{ {
insn = EXTRACT_INSN (&prologue[vpc]); insn = extract_unsigned_integer (&prologue[vpc], 2, byte_order);
if ((insn & 0xff00) == 0x0100) /* movw rXX, rYY */ if ((insn & 0xff00) == 0x0100) /* movw rXX, rYY */
continue; continue;
else if ((insn & 0xfc00) == 0x2c00) /* mov rXX, rYY */ else if ((insn & 0xfc00) == 0x2c00) /* mov rXX, rYY */
@ -776,7 +779,7 @@ avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
prologue and possibly skip over moving arguments passed via registers prologue and possibly skip over moving arguments passed via registers
to other registers. */ to other registers. */
prologue_end = avr_scan_prologue (func_addr, func_end, &info); prologue_end = avr_scan_prologue (gdbarch, func_addr, func_end, &info);
if (info.prologue_type == AVR_PROLOGUE_NONE) if (info.prologue_type == AVR_PROLOGUE_NONE)
return pc; return pc;
@ -817,13 +820,15 @@ static void
avr_extract_return_value (struct type *type, struct regcache *regcache, avr_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf) gdb_byte *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST r24, r25; ULONGEST r24, r25;
ULONGEST c; ULONGEST c;
int len; int len;
if (TYPE_LENGTH (type) == 1) if (TYPE_LENGTH (type) == 1)
{ {
regcache_cooked_read_unsigned (regcache, 24, &c); regcache_cooked_read_unsigned (regcache, 24, &c);
store_unsigned_integer (valbuf, 1, c); store_unsigned_integer (valbuf, 1, byte_order, c);
} }
else else
{ {
@ -909,7 +914,8 @@ avr_frame_unwind_cache (struct frame_info *this_frame,
start_pc = get_frame_func (this_frame); start_pc = get_frame_func (this_frame);
current_pc = get_frame_pc (this_frame); current_pc = get_frame_pc (this_frame);
if ((start_pc > 0) && (start_pc <= current_pc)) if ((start_pc > 0) && (start_pc <= current_pc))
avr_scan_prologue (start_pc, current_pc, info); avr_scan_prologue (get_frame_arch (this_frame),
start_pc, current_pc, info);
if ((info->prologue_type != AVR_PROLOGUE_NONE) if ((info->prologue_type != AVR_PROLOGUE_NONE)
&& (info->prologue_type != AVR_PROLOGUE_MAIN)) && (info->prologue_type != AVR_PROLOGUE_MAIN))
@ -1015,6 +1021,8 @@ static struct value *
avr_frame_prev_register (struct frame_info *this_frame, avr_frame_prev_register (struct frame_info *this_frame,
void **this_prologue_cache, int regnum) void **this_prologue_cache, int regnum)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct avr_unwind_cache *info struct avr_unwind_cache *info
= avr_frame_unwind_cache (this_frame, this_prologue_cache); = avr_frame_unwind_cache (this_frame, this_prologue_cache);
@ -1171,6 +1179,7 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i; int i;
unsigned char buf[2]; unsigned char buf[2];
CORE_ADDR return_pc = avr_convert_iaddr_to_raw (bp_addr); CORE_ADDR return_pc = avr_convert_iaddr_to_raw (bp_addr);
@ -1209,7 +1218,7 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (len & 1) if (len & 1)
regnum--; regnum--;
val = extract_unsigned_integer (contents, len); val = extract_unsigned_integer (contents, len, byte_order);
for (j=0; j<len; j++) for (j=0; j<len; j++)
{ {
regcache_cooked_write_unsigned (regcache, regnum--, regcache_cooked_write_unsigned (regcache, regnum--,

View file

@ -93,7 +93,8 @@ bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
static void static void
bsd_uthread_check_magic (CORE_ADDR addr) bsd_uthread_check_magic (CORE_ADDR addr)
{ {
ULONGEST magic = read_memory_unsigned_integer (addr, 4); enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
ULONGEST magic = read_memory_unsigned_integer (addr, 4, byte_order);
if (magic != BSD_UTHREAD_PTHREAD_MAGIC) if (magic != BSD_UTHREAD_PTHREAD_MAGIC)
error (_("Bad magic")); error (_("Bad magic"));
@ -136,13 +137,14 @@ bsd_uthread_lookup_address (const char *name, struct objfile *objfile)
static int static int
bsd_uthread_lookup_offset (const char *name, struct objfile *objfile) bsd_uthread_lookup_offset (const char *name, struct objfile *objfile)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
CORE_ADDR addr; CORE_ADDR addr;
addr = bsd_uthread_lookup_address (name, objfile); addr = bsd_uthread_lookup_address (name, objfile);
if (addr == 0) if (addr == 0)
return 0; return 0;
return read_memory_unsigned_integer (addr, 4); return read_memory_unsigned_integer (addr, 4, byte_order);
} }
static CORE_ADDR static CORE_ADDR
@ -347,6 +349,7 @@ static ptid_t
bsd_uthread_wait (struct target_ops *ops, bsd_uthread_wait (struct target_ops *ops,
ptid_t ptid, struct target_waitstatus *status, int options) ptid_t ptid, struct target_waitstatus *status, int options)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
CORE_ADDR addr; CORE_ADDR addr;
struct target_ops *beneath = find_target_beneath (ops); struct target_ops *beneath = find_target_beneath (ops);
@ -372,7 +375,7 @@ bsd_uthread_wait (struct target_ops *ops,
been read from the wrong virtual memory image. */ been read from the wrong virtual memory image. */
if (target_read_memory (addr, buf, 4) == 0) if (target_read_memory (addr, buf, 4) == 0)
{ {
ULONGEST magic = extract_unsigned_integer (buf, 4); ULONGEST magic = extract_unsigned_integer (buf, 4, byte_order);
if (magic == BSD_UTHREAD_PTHREAD_MAGIC) if (magic == BSD_UTHREAD_PTHREAD_MAGIC)
ptid = ptid_build (ptid_get_pid (ptid), 0, addr); ptid = ptid_build (ptid_get_pid (ptid), 0, addr);
} }
@ -404,6 +407,7 @@ bsd_uthread_resume (struct target_ops *ops,
static int static int
bsd_uthread_thread_alive (struct target_ops *ops, ptid_t ptid) bsd_uthread_thread_alive (struct target_ops *ops, ptid_t ptid)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
struct target_ops *beneath = find_target_beneath (ops); struct target_ops *beneath = find_target_beneath (ops);
CORE_ADDR addr = ptid_get_tid (inferior_ptid); CORE_ADDR addr = ptid_get_tid (inferior_ptid);
@ -414,7 +418,7 @@ bsd_uthread_thread_alive (struct target_ops *ops, ptid_t ptid)
bsd_uthread_check_magic (addr); bsd_uthread_check_magic (addr);
state = read_memory_unsigned_integer (addr + offset, 4); state = read_memory_unsigned_integer (addr + offset, 4, byte_order);
if (state == BSD_UTHREAD_PS_DEAD) if (state == BSD_UTHREAD_PS_DEAD)
return 0; return 0;
} }
@ -480,6 +484,7 @@ static char *bsd_uthread_state[] =
static char * static char *
bsd_uthread_extra_thread_info (struct thread_info *info) bsd_uthread_extra_thread_info (struct thread_info *info)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
CORE_ADDR addr = ptid_get_tid (info->ptid); CORE_ADDR addr = ptid_get_tid (info->ptid);
if (addr != 0) if (addr != 0)
@ -487,7 +492,7 @@ bsd_uthread_extra_thread_info (struct thread_info *info)
int offset = bsd_uthread_thread_state_offset; int offset = bsd_uthread_thread_state_offset;
ULONGEST state; ULONGEST state;
state = read_memory_unsigned_integer (addr + offset, 4); state = read_memory_unsigned_integer (addr + offset, 4, byte_order);
if (state < ARRAY_SIZE (bsd_uthread_state)) if (state < ARRAY_SIZE (bsd_uthread_state))
return bsd_uthread_state[state]; return bsd_uthread_state[state];
} }

View file

@ -1181,7 +1181,8 @@ parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
p[len - 2] = '\0'; p[len - 2] = '\0';
putithere->typed_val_decfloat.type putithere->typed_val_decfloat.type
= parse_type->builtin_decfloat; = parse_type->builtin_decfloat;
decimal_from_string (putithere->typed_val_decfloat.val, 4, p); decimal_from_string (putithere->typed_val_decfloat.val, 4,
gdbarch_byte_order (parse_gdbarch), p);
p[len - 2] = 'd'; p[len - 2] = 'd';
return DECFLOAT; return DECFLOAT;
} }
@ -1191,7 +1192,8 @@ parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
p[len - 2] = '\0'; p[len - 2] = '\0';
putithere->typed_val_decfloat.type putithere->typed_val_decfloat.type
= parse_type->builtin_decdouble; = parse_type->builtin_decdouble;
decimal_from_string (putithere->typed_val_decfloat.val, 8, p); decimal_from_string (putithere->typed_val_decfloat.val, 8,
gdbarch_byte_order (parse_gdbarch), p);
p[len - 2] = 'd'; p[len - 2] = 'd';
return DECFLOAT; return DECFLOAT;
} }
@ -1201,7 +1203,8 @@ parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
p[len - 2] = '\0'; p[len - 2] = '\0';
putithere->typed_val_decfloat.type putithere->typed_val_decfloat.type
= parse_type->builtin_declong; = parse_type->builtin_declong;
decimal_from_string (putithere->typed_val_decfloat.val, 16, p); decimal_from_string (putithere->typed_val_decfloat.val, 16,
gdbarch_byte_order (parse_gdbarch), p);
p[len - 2] = 'd'; p[len - 2] = 'd';
return DECFLOAT; return DECFLOAT;
} }

View file

@ -42,23 +42,24 @@ extern void _initialize_c_language (void);
character set name. */ character set name. */
static const char * static const char *
charset_for_string_type (enum c_string_type str_type) charset_for_string_type (enum c_string_type str_type,
enum bfd_endian byte_order)
{ {
switch (str_type & ~C_CHAR) switch (str_type & ~C_CHAR)
{ {
case C_STRING: case C_STRING:
return target_charset (); return target_charset ();
case C_WIDE_STRING: case C_WIDE_STRING:
return target_wide_charset (); return target_wide_charset (byte_order);
case C_STRING_16: case C_STRING_16:
/* FIXME: UCS-2 is not always correct. */ /* FIXME: UCS-2 is not always correct. */
if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) if (byte_order == BFD_ENDIAN_BIG)
return "UCS-2BE"; return "UCS-2BE";
else else
return "UCS-2LE"; return "UCS-2LE";
case C_STRING_32: case C_STRING_32:
/* FIXME: UCS-4 is not always correct. */ /* FIXME: UCS-4 is not always correct. */
if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) if (byte_order == BFD_ENDIAN_BIG)
return "UCS-4BE"; return "UCS-4BE";
else else
return "UCS-4LE"; return "UCS-4LE";
@ -69,10 +70,11 @@ charset_for_string_type (enum c_string_type str_type)
/* Classify ELTTYPE according to what kind of character it is. Return /* Classify ELTTYPE according to what kind of character it is. Return
the enum constant representing the character type. Also set the enum constant representing the character type. Also set
*ENCODING to the name of the character set to use when converting *ENCODING to the name of the character set to use when converting
characters of this type to the host character set. */ characters of this type in target BYTE_ORDER to the host character set. */
static enum c_string_type static enum c_string_type
classify_type (struct type *elttype, const char **encoding) classify_type (struct type *elttype, enum bfd_endian byte_order,
const char **encoding)
{ {
struct type *saved_type; struct type *saved_type;
enum c_string_type result; enum c_string_type result;
@ -131,7 +133,9 @@ classify_type (struct type *elttype, const char **encoding)
result = C_CHAR; result = C_CHAR;
done: done:
*encoding = charset_for_string_type (result); if (encoding)
*encoding = charset_for_string_type (result, byte_order);
return result; return result;
} }
@ -172,8 +176,8 @@ append_string_as_wide (const char *string, struct obstack *output)
static void static void
print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len, print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len,
int width, struct obstack *output, int quoter, int width, enum bfd_endian byte_order, struct obstack *output,
int *need_escapep) int quoter, int *need_escapep)
{ {
int need_escape = *need_escapep; int need_escape = *need_escapep;
*need_escapep = 0; *need_escapep = 0;
@ -219,7 +223,8 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len,
for (i = 0; i + width <= orig_len; i += width) for (i = 0; i + width <= orig_len; i += width)
{ {
char octal[30]; char octal[30];
ULONGEST value = extract_unsigned_integer (&orig[i], width); ULONGEST value;
value = extract_unsigned_integer (&orig[i], width, byte_order);
sprintf (octal, "\\%lo", (long) value); sprintf (octal, "\\%lo", (long) value);
append_string_as_wide (octal, output); append_string_as_wide (octal, output);
} }
@ -246,6 +251,7 @@ print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len,
static void static void
c_emit_char (int c, struct type *type, struct ui_file *stream, int quoter) c_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
struct obstack wchar_buf, output; struct obstack wchar_buf, output;
struct cleanup *cleanups; struct cleanup *cleanups;
const char *encoding; const char *encoding;
@ -253,7 +259,7 @@ c_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
struct wchar_iterator *iter; struct wchar_iterator *iter;
int need_escape = 0; int need_escape = 0;
classify_type (type, &encoding); classify_type (type, byte_order, &encoding);
buf = alloca (TYPE_LENGTH (type)); buf = alloca (TYPE_LENGTH (type));
pack_long (buf, type, c); pack_long (buf, type, c);
@ -299,14 +305,14 @@ c_emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
{ {
for (i = 0; i < num_chars; ++i) for (i = 0; i < num_chars; ++i)
print_wchar (chars[i], buf, buflen, TYPE_LENGTH (type), print_wchar (chars[i], buf, buflen, TYPE_LENGTH (type),
&wchar_buf, quoter, &need_escape); byte_order, &wchar_buf, quoter, &need_escape);
} }
} }
/* This handles the NUM_CHARS == 0 case as well. */ /* This handles the NUM_CHARS == 0 case as well. */
if (print_escape) if (print_escape)
print_wchar (gdb_WEOF, buf, buflen, TYPE_LENGTH (type), &wchar_buf, print_wchar (gdb_WEOF, buf, buflen, TYPE_LENGTH (type), byte_order,
quoter, &need_escape); &wchar_buf, quoter, &need_escape);
} }
/* The output in the host encoding. */ /* The output in the host encoding. */
@ -328,9 +334,8 @@ void
c_printchar (int c, struct type *type, struct ui_file *stream) c_printchar (int c, struct type *type, struct ui_file *stream)
{ {
enum c_string_type str_type; enum c_string_type str_type;
const char *encoding;
str_type = classify_type (type, &encoding); str_type = classify_type (type, BFD_ENDIAN_UNKNOWN, NULL);
switch (str_type) switch (str_type)
{ {
case C_CHAR: case C_CHAR:
@ -362,6 +367,7 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
unsigned int length, int force_ellipses, unsigned int length, int force_ellipses,
const struct value_print_options *options) const struct value_print_options *options)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
unsigned int i; unsigned int i;
unsigned int things_printed = 0; unsigned int things_printed = 0;
int in_quotes = 0; int in_quotes = 0;
@ -380,10 +386,11 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
style. */ style. */
if (!force_ellipses if (!force_ellipses
&& length > 0 && length > 0
&& (extract_unsigned_integer (string + (length - 1) * width, width) == 0)) && (extract_unsigned_integer (string + (length - 1) * width,
width, byte_order) == 0))
length--; length--;
str_type = classify_type (type, &encoding) & ~C_CHAR; str_type = classify_type (type, byte_order, &encoding) & ~C_CHAR;
switch (str_type) switch (str_type)
{ {
case C_STRING: case C_STRING:
@ -411,7 +418,8 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
for (i = 0; current_char; ++i) for (i = 0; current_char; ++i)
{ {
QUIT; QUIT;
current_char = extract_unsigned_integer (string + i * width, width); current_char = extract_unsigned_integer (string + i * width,
width, byte_order);
} }
length = i; length = i;
} }
@ -481,7 +489,7 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
obstack_grow_wstr (&wchar_buf, LCST ("'")); obstack_grow_wstr (&wchar_buf, LCST ("'"));
need_escape = 0; need_escape = 0;
print_wchar (current_char, orig_buf, orig_len, width, print_wchar (current_char, orig_buf, orig_len, width,
&wchar_buf, '\'', &need_escape); byte_order, &wchar_buf, '\'', &need_escape);
obstack_grow_wstr (&wchar_buf, LCST ("'")); obstack_grow_wstr (&wchar_buf, LCST ("'"));
{ {
/* Painful gyrations. */ /* Painful gyrations. */
@ -514,7 +522,7 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
while (reps-- > 0) while (reps-- > 0)
{ {
print_wchar (current_char, orig_buf, orig_len, width, print_wchar (current_char, orig_buf, orig_len, width,
&wchar_buf, '"', &need_escape); byte_order, &wchar_buf, '"', &need_escape);
++things_printed; ++things_printed;
} }
} }
@ -541,7 +549,7 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
in_quotes = 1; in_quotes = 1;
} }
need_escape = 0; need_escape = 0;
print_wchar (gdb_WEOF, buf, buflen, width, &wchar_buf, print_wchar (gdb_WEOF, buf, buflen, width, byte_order, &wchar_buf,
'"', &need_escape); '"', &need_escape);
break; break;
@ -555,7 +563,7 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
in_quotes = 0; in_quotes = 0;
} }
obstack_grow_wstr (&wchar_buf, LCST (" <incomplete sequence ")); obstack_grow_wstr (&wchar_buf, LCST (" <incomplete sequence "));
print_wchar (gdb_WEOF, buf, buflen, width, &wchar_buf, print_wchar (gdb_WEOF, buf, buflen, width, byte_order, &wchar_buf,
0, &need_escape); 0, &need_escape);
obstack_grow_wstr (&wchar_buf, LCST (">")); obstack_grow_wstr (&wchar_buf, LCST (">"));
finished = 1; finished = 1;
@ -612,6 +620,7 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length,
unsigned int fetchlimit; unsigned int fetchlimit;
struct type *type = check_typedef (value_type (value)); struct type *type = check_typedef (value_type (value));
struct type *element_type = TYPE_TARGET_TYPE (type); struct type *element_type = TYPE_TARGET_TYPE (type);
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
if (element_type == NULL) if (element_type == NULL)
goto error; goto error;
@ -659,7 +668,8 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length,
/* Look for a null character. */ /* Look for a null character. */
for (i = 0; i < fetchlimit; i++) for (i = 0; i < fetchlimit; i++)
if (extract_unsigned_integer (contents + i * width, width) == 0) if (extract_unsigned_integer (contents + i * width, width,
byte_order) == 0)
break; break;
/* I is now either the number of non-null characters, or FETCHLIMIT. */ /* I is now either the number of non-null characters, or FETCHLIMIT. */
@ -671,7 +681,7 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length,
else else
{ {
err = read_string (value_as_address (value), -1, width, fetchlimit, err = read_string (value_as_address (value), -1, width, fetchlimit,
buffer, length); byte_order, buffer, length);
if (err) if (err)
{ {
xfree (*buffer); xfree (*buffer);
@ -682,7 +692,8 @@ c_get_string (struct value *value, gdb_byte **buffer, int *length,
/* If the last character is null, subtract it from LENGTH. */ /* If the last character is null, subtract it from LENGTH. */
if (*length > 0 if (*length > 0
&& extract_unsigned_integer (*buffer + *length - width, width) == 0) && extract_unsigned_integer (*buffer + *length - width, width,
byte_order) == 0)
*length -= width; *length -= width;
*charset = target_charset (); *charset = target_charset ();
@ -905,6 +916,7 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp,
struct value *result; struct value *result;
enum c_string_type dest_type; enum c_string_type dest_type;
const char *dest_charset; const char *dest_charset;
enum bfd_endian byte_order;
obstack_init (&output); obstack_init (&output);
cleanup = make_cleanup_obstack_free (&output); cleanup = make_cleanup_obstack_free (&output);
@ -941,7 +953,8 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp,
/* Ensure TYPE_LENGTH is valid for TYPE. */ /* Ensure TYPE_LENGTH is valid for TYPE. */
check_typedef (type); check_typedef (type);
dest_charset = charset_for_string_type (dest_type); byte_order = gdbarch_byte_order (exp->gdbarch);
dest_charset = charset_for_string_type (dest_type, byte_order);
++*pos; ++*pos;
while (*pos < limit) while (*pos < limit)

View file

@ -153,6 +153,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct gdbarch *gdbarch = get_type_arch (type); struct gdbarch *gdbarch = get_type_arch (type);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int i = 0; /* Number of characters printed */ unsigned int i = 0; /* Number of characters printed */
unsigned len; unsigned len;
struct type *elttype, *unresolved_elttype; struct type *elttype, *unresolved_elttype;
@ -190,7 +191,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
&& temp_len < options->print_max && temp_len < options->print_max
&& extract_unsigned_integer (valaddr + embedded_offset && extract_unsigned_integer (valaddr + embedded_offset
+ temp_len * eltlen, + temp_len * eltlen,
eltlen) == 0); eltlen, byte_order) == 0);
++temp_len) ++temp_len)
; ;
len = temp_len; len = temp_len;

View file

@ -358,9 +358,9 @@ target_charset (void)
} }
const char * const char *
target_wide_charset (void) target_wide_charset (enum bfd_endian byte_order)
{ {
if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) if (byte_order == BFD_ENDIAN_BIG)
{ {
if (target_wide_charset_be_name) if (target_wide_charset_be_name)
return target_wide_charset_be_name; return target_wide_charset_be_name;

View file

@ -34,7 +34,7 @@
it. */ it. */
const char *host_charset (void); const char *host_charset (void);
const char *target_charset (void); const char *target_charset (void);
const char *target_wide_charset (void); const char *target_wide_charset (enum bfd_endian byte_order);
/* These values are used to specify the type of transliteration done /* These values are used to specify the type of transliteration done
by convert_between_encodings. */ by convert_between_encodings. */

View file

@ -246,6 +246,7 @@ struct captured_read_memory_integer_arguments
{ {
CORE_ADDR memaddr; CORE_ADDR memaddr;
int len; int len;
enum bfd_endian byte_order;
LONGEST result; LONGEST result;
}; };
@ -262,8 +263,9 @@ do_captured_read_memory_integer (void *data)
struct captured_read_memory_integer_arguments *args = (struct captured_read_memory_integer_arguments*) data; struct captured_read_memory_integer_arguments *args = (struct captured_read_memory_integer_arguments*) data;
CORE_ADDR memaddr = args->memaddr; CORE_ADDR memaddr = args->memaddr;
int len = args->len; int len = args->len;
enum bfd_endian byte_order = args->byte_order;
args->result = read_memory_integer (memaddr, len); args->result = read_memory_integer (memaddr, len, byte_order);
return 1; return 1;
} }
@ -273,12 +275,14 @@ do_captured_read_memory_integer (void *data)
if successful. */ if successful. */
int int
safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value) safe_read_memory_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order,
LONGEST *return_value)
{ {
int status; int status;
struct captured_read_memory_integer_arguments args; struct captured_read_memory_integer_arguments args;
args.memaddr = memaddr; args.memaddr = memaddr;
args.len = len; args.len = len;
args.byte_order = byte_order;
status = catch_errors (do_captured_read_memory_integer, &args, status = catch_errors (do_captured_read_memory_integer, &args,
"", RETURN_MASK_ALL); "", RETURN_MASK_ALL);
@ -289,21 +293,21 @@ safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value)
} }
LONGEST LONGEST
read_memory_integer (CORE_ADDR memaddr, int len) read_memory_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
{ {
gdb_byte buf[sizeof (LONGEST)]; gdb_byte buf[sizeof (LONGEST)];
read_memory (memaddr, buf, len); read_memory (memaddr, buf, len);
return extract_signed_integer (buf, len); return extract_signed_integer (buf, len, byte_order);
} }
ULONGEST ULONGEST
read_memory_unsigned_integer (CORE_ADDR memaddr, int len) read_memory_unsigned_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
{ {
gdb_byte buf[sizeof (ULONGEST)]; gdb_byte buf[sizeof (ULONGEST)];
read_memory (memaddr, buf, len); read_memory (memaddr, buf, len);
return extract_unsigned_integer (buf, len); return extract_unsigned_integer (buf, len, byte_order);
} }
void void
@ -353,19 +357,21 @@ write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */ /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
void void
write_memory_unsigned_integer (CORE_ADDR addr, int len, ULONGEST value) write_memory_unsigned_integer (CORE_ADDR addr, int len, enum bfd_endian byte_order,
ULONGEST value)
{ {
gdb_byte *buf = alloca (len); gdb_byte *buf = alloca (len);
store_unsigned_integer (buf, len, value); store_unsigned_integer (buf, len, byte_order, value);
write_memory (addr, buf, len); write_memory (addr, buf, len);
} }
/* Store VALUE at ADDR in the inferior as a LEN-byte signed integer. */ /* Store VALUE at ADDR in the inferior as a LEN-byte signed integer. */
void void
write_memory_signed_integer (CORE_ADDR addr, int len, LONGEST value) write_memory_signed_integer (CORE_ADDR addr, int len, enum bfd_endian byte_order,
LONGEST value)
{ {
gdb_byte *buf = alloca (len); gdb_byte *buf = alloca (len);
store_signed_integer (buf, len, value); store_signed_integer (buf, len, byte_order, value);
write_memory (addr, buf, len); write_memory (addr, buf, len);
} }

View file

@ -564,13 +564,17 @@ void
cp_print_class_member (const gdb_byte *valaddr, struct type *type, cp_print_class_member (const gdb_byte *valaddr, struct type *type,
struct ui_file *stream, char *prefix) struct ui_file *stream, char *prefix)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
/* VAL is a byte offset into the structure type DOMAIN. /* VAL is a byte offset into the structure type DOMAIN.
Find the name of the field for that offset and Find the name of the field for that offset and
print it. */ print it. */
struct type *domain = TYPE_DOMAIN_TYPE (type); struct type *domain = TYPE_DOMAIN_TYPE (type);
LONGEST val = extract_signed_integer (valaddr, TYPE_LENGTH (type)); LONGEST val;
unsigned int fieldno; unsigned int fieldno;
val = extract_signed_integer (valaddr, TYPE_LENGTH (type), byte_order);
/* Pointers to data members are usually byte offsets into an object. /* Pointers to data members are usually byte offsets into an object.
Because a data member can have offset zero, and a NULL pointer to Because a data member can have offset zero, and a NULL pointer to
member must be distinct from any valid non-NULL pointer to member must be distinct from any valid non-NULL pointer to

View file

@ -259,13 +259,14 @@ cris_rt_sigtramp_start (struct frame_info *this_frame)
static CORE_ADDR static CORE_ADDR
cris_sigcontext_addr (struct frame_info *this_frame) cris_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc; CORE_ADDR pc;
CORE_ADDR sp; CORE_ADDR sp;
char buf[4]; char buf[4];
get_frame_register (this_frame, get_frame_register (this_frame, gdbarch_sp_regnum (gdbarch), buf);
gdbarch_sp_regnum (get_frame_arch (this_frame)), buf); sp = extract_unsigned_integer (buf, 4, byte_order);
sp = extract_unsigned_integer (buf, 4);
/* Look for normal sigtramp frame first. */ /* Look for normal sigtramp frame first. */
pc = cris_sigtramp_start (this_frame); pc = cris_sigtramp_start (this_frame);
@ -321,6 +322,7 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct cris_unwind_cache *info; struct cris_unwind_cache *info;
CORE_ADDR pc; CORE_ADDR pc;
CORE_ADDR sp; CORE_ADDR sp;
@ -346,7 +348,7 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
info->leaf_function = 0; info->leaf_function = 0;
get_frame_register (this_frame, gdbarch_sp_regnum (gdbarch), buf); get_frame_register (this_frame, gdbarch_sp_regnum (gdbarch), buf);
info->base = extract_unsigned_integer (buf, 4); info->base = extract_unsigned_integer (buf, 4, byte_order);
addr = cris_sigcontext_addr (this_frame); addr = cris_sigcontext_addr (this_frame);
@ -535,6 +537,7 @@ struct instruction_environment
int delay_slot_pc_active; int delay_slot_pc_active;
int xflag_found; int xflag_found;
int disable_interrupt; int disable_interrupt;
int byte_order;
} inst_env_type; } inst_env_type;
/* Machine-dependencies in CRIS for opcodes. */ /* Machine-dependencies in CRIS for opcodes. */
@ -862,6 +865,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int stack_alloc; int stack_alloc;
int stack_offset; int stack_offset;
int argreg; int argreg;
@ -952,7 +956,7 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else else
{ {
gdb_byte buf[4]; gdb_byte buf[4];
store_unsigned_integer (buf, 4, sp); store_unsigned_integer (buf, 4, byte_order, sp);
si = push_stack_item (si, buf, 4); si = push_stack_item (si, buf, 4);
} }
} }
@ -1085,6 +1089,8 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
struct cris_unwind_cache *info) struct cris_unwind_cache *info)
{ {
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);
/* Present instruction. */ /* Present instruction. */
unsigned short insn; unsigned short insn;
@ -1126,12 +1132,12 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
/* Find the prologue instructions. */ /* Find the prologue instructions. */
while (pc > 0 && pc < limit) while (pc > 0 && pc < limit)
{ {
insn = read_memory_unsigned_integer (pc, 2); insn = read_memory_unsigned_integer (pc, 2, byte_order);
pc += 2; pc += 2;
if (insn == 0xE1FC) if (insn == 0xE1FC)
{ {
/* push <reg> 32 bit instruction */ /* push <reg> 32 bit instruction */
insn_next = read_memory_unsigned_integer (pc, 2); insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
pc += 2; pc += 2;
regno = cris_get_operand2 (insn_next); regno = cris_get_operand2 (insn_next);
if (info) if (info)
@ -1195,7 +1201,7 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
{ {
info->sp_offset += -cris_get_signed_offset (insn); info->sp_offset += -cris_get_signed_offset (insn);
} }
insn_next = read_memory_unsigned_integer (pc, 2); insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
pc += 2; pc += 2;
if (cris_get_mode (insn_next) == PREFIX_ASSIGN_MODE if (cris_get_mode (insn_next) == PREFIX_ASSIGN_MODE
&& cris_get_opcode (insn_next) == 0x000F && cris_get_opcode (insn_next) == 0x000F
@ -1240,7 +1246,7 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
&& (cris_get_signed_offset (insn) < 0)) && (cris_get_signed_offset (insn) < 0))
{ {
/* move.S rZ,[r8-U] (?) */ /* move.S rZ,[r8-U] (?) */
insn_next = read_memory_unsigned_integer (pc, 2); insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
pc += 2; pc += 2;
regno = cris_get_operand2 (insn_next); regno = cris_get_operand2 (insn_next);
if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch)) if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
@ -1264,7 +1270,7 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
&& (cris_get_signed_offset (insn) > 0)) && (cris_get_signed_offset (insn) > 0))
{ {
/* move.S [r8+U],rZ (?) */ /* move.S [r8+U],rZ (?) */
insn_next = read_memory_unsigned_integer (pc, 2); insn_next = read_memory_unsigned_integer (pc, 2, byte_order);
pc += 2; pc += 2;
regno = cris_get_operand2 (insn_next); regno = cris_get_operand2 (insn_next);
if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch)) if ((regno >= 0 && regno < gdbarch_sp_regnum (gdbarch))
@ -1703,21 +1709,23 @@ static void
cris_store_return_value (struct type *type, struct regcache *regcache, cris_store_return_value (struct type *type, struct regcache *regcache,
const void *valbuf) const void *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val; ULONGEST val;
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
if (len <= 4) if (len <= 4)
{ {
/* Put the return value in R10. */ /* Put the return value in R10. */
val = extract_unsigned_integer (valbuf, len); val = extract_unsigned_integer (valbuf, len, byte_order);
regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val); regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val);
} }
else if (len <= 8) else if (len <= 8)
{ {
/* Put the return value in R10 and R11. */ /* Put the return value in R10 and R11. */
val = extract_unsigned_integer (valbuf, 4); val = extract_unsigned_integer (valbuf, 4, byte_order);
regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val); regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val);
val = extract_unsigned_integer ((char *)valbuf + 4, len - 4); val = extract_unsigned_integer ((char *)valbuf + 4, len - 4, byte_order);
regcache_cooked_write_unsigned (regcache, ARG2_REGNUM, val); regcache_cooked_write_unsigned (regcache, ARG2_REGNUM, val);
} }
else else
@ -1872,6 +1880,8 @@ static void
cris_extract_return_value (struct type *type, struct regcache *regcache, cris_extract_return_value (struct type *type, struct regcache *regcache,
void *valbuf) void *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val; ULONGEST val;
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
@ -1879,15 +1889,15 @@ cris_extract_return_value (struct type *type, struct regcache *regcache,
{ {
/* Get the return value from R10. */ /* Get the return value from R10. */
regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val); regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val);
store_unsigned_integer (valbuf, len, val); store_unsigned_integer (valbuf, len, byte_order, val);
} }
else if (len <= 8) else if (len <= 8)
{ {
/* Get the return value from R10 and R11. */ /* Get the return value from R10 and R11. */
regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val); regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val);
store_unsigned_integer (valbuf, 4, val); store_unsigned_integer (valbuf, 4, byte_order, val);
regcache_cooked_read_unsigned (regcache, ARG2_REGNUM, &val); regcache_cooked_read_unsigned (regcache, ARG2_REGNUM, &val);
store_unsigned_integer ((char *)valbuf + 4, len - 4, val); store_unsigned_integer ((char *)valbuf + 4, len - 4, byte_order, val);
} }
else else
error (_("cris_extract_return_value: type length too large")); error (_("cris_extract_return_value: type length too large"));
@ -2054,6 +2064,7 @@ find_step_target (struct frame_info *frame, inst_env_type *inst_env)
int offset; int offset;
unsigned short insn; unsigned short insn;
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Create a local register image and set the initial state. */ /* Create a local register image and set the initial state. */
for (i = 0; i < NUM_GENREGS; i++) for (i = 0; i < NUM_GENREGS; i++)
@ -2074,13 +2085,14 @@ find_step_target (struct frame_info *frame, inst_env_type *inst_env)
inst_env->invalid = 0; inst_env->invalid = 0;
inst_env->xflag_found = 0; inst_env->xflag_found = 0;
inst_env->disable_interrupt = 0; inst_env->disable_interrupt = 0;
inst_env->byte_order = byte_order;
/* Look for a step target. */ /* Look for a step target. */
do do
{ {
/* Read an instruction from the client. */ /* Read an instruction from the client. */
insn = read_memory_unsigned_integer insn = read_memory_unsigned_integer
(inst_env->reg[gdbarch_pc_regnum (gdbarch)], 2); (inst_env->reg[gdbarch_pc_regnum (gdbarch)], 2, byte_order);
/* If the instruction is not in a delay slot the new content of the /* If the instruction is not in a delay slot the new content of the
PC is [PC] + 2. If the instruction is in a delay slot it is not PC is [PC] + 2. If the instruction is in a delay slot it is not
@ -2209,7 +2221,8 @@ process_autoincrement (int size, unsigned short inst, inst_env_type *inst_env)
/* Just a forward declaration. */ /* Just a forward declaration. */
static unsigned long get_data_from_address (unsigned short *inst, static unsigned long get_data_from_address (unsigned short *inst,
CORE_ADDR address); CORE_ADDR address,
enum bfd_endian byte_order);
/* Calculates the prefix value for the general case of offset addressing /* Calculates the prefix value for the general case of offset addressing
mode. */ mode. */
@ -2235,7 +2248,8 @@ bdap_prefix (unsigned short inst, inst_env_type *inst_env)
/* The offset is an indirection of the contents of the operand1 register. */ /* The offset is an indirection of the contents of the operand1 register. */
inst_env->prefix_value += inst_env->prefix_value +=
get_data_from_address (&inst, inst_env->reg[cris_get_operand1 (inst)]); get_data_from_address (&inst, inst_env->reg[cris_get_operand1 (inst)],
inst_env->byte_order);
if (cris_get_mode (inst) == AUTOINC_MODE) if (cris_get_mode (inst) == AUTOINC_MODE)
{ {
@ -2301,7 +2315,8 @@ dip_prefix (unsigned short inst, inst_env_type *inst_env)
/* The prefix value is one dereference of the contents of the operand1 /* The prefix value is one dereference of the contents of the operand1
register. */ register. */
address = (CORE_ADDR) inst_env->reg[cris_get_operand1 (inst)]; address = (CORE_ADDR) inst_env->reg[cris_get_operand1 (inst)];
inst_env->prefix_value = read_memory_unsigned_integer (address, 4); inst_env->prefix_value
= read_memory_unsigned_integer (address, 4, inst_env->byte_order);
/* Check if the mode is autoincrement. */ /* Check if the mode is autoincrement. */
if (cris_get_mode (inst) == AUTOINC_MODE) if (cris_get_mode (inst) == AUTOINC_MODE)
@ -2368,7 +2383,7 @@ sixteen_bit_offset_branch_op (unsigned short inst, inst_env_type *inst_env)
} }
/* We have a branch, find out the offset for the branch. */ /* We have a branch, find out the offset for the branch. */
offset = read_memory_integer (inst_env->reg[REG_PC], 2); offset = read_memory_integer (inst_env->reg[REG_PC], 2, inst_env->byte_order);
/* The instruction is one word longer than normal, so add one word /* The instruction is one word longer than normal, so add one word
to the PC. */ to the PC. */
@ -2877,13 +2892,14 @@ none_reg_mode_jump_op (unsigned short inst, inst_env_type *inst_env)
/* Get the new value for the the PC. */ /* Get the new value for the the PC. */
newpc = newpc =
read_memory_unsigned_integer ((CORE_ADDR) inst_env->prefix_value, read_memory_unsigned_integer ((CORE_ADDR) inst_env->prefix_value,
4); 4, inst_env->byte_order);
} }
else else
{ {
/* Get the new value for the PC. */ /* Get the new value for the PC. */
address = (CORE_ADDR) inst_env->reg[cris_get_operand1 (inst)]; address = (CORE_ADDR) inst_env->reg[cris_get_operand1 (inst)];
newpc = read_memory_unsigned_integer (address, 4); newpc = read_memory_unsigned_integer (address,
4, inst_env->byte_order);
/* Check if we should increment a register. */ /* Check if we should increment a register. */
if (cris_get_mode (inst) == AUTOINC_MODE) if (cris_get_mode (inst) == AUTOINC_MODE)
@ -3058,7 +3074,8 @@ move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env)
if (cris_get_operand2 (inst) >= REG_PC) if (cris_get_operand2 (inst) >= REG_PC)
{ {
inst_env->reg[REG_PC] = inst_env->reg[REG_PC] =
read_memory_unsigned_integer (inst_env->prefix_value, 4); read_memory_unsigned_integer (inst_env->prefix_value,
4, inst_env->byte_order);
} }
/* The assign value is the value after the increment. Normally, the /* The assign value is the value after the increment. Normally, the
assign value is the value before the increment. */ assign value is the value before the increment. */
@ -3082,7 +3099,7 @@ move_mem_to_reg_movem_op (unsigned short inst, inst_env_type *inst_env)
} }
inst_env->reg[REG_PC] = inst_env->reg[REG_PC] =
read_memory_unsigned_integer (inst_env->reg[cris_get_operand1 (inst)], read_memory_unsigned_integer (inst_env->reg[cris_get_operand1 (inst)],
4); 4, inst_env->byte_order);
} }
/* The increment is not depending on the size, instead it's depending /* The increment is not depending on the size, instead it's depending
on the number of registers loaded from memory. */ on the number of registers loaded from memory. */
@ -3396,7 +3413,7 @@ reg_mode_add_sub_cmp_and_or_move_op (unsigned short inst,
extend instruction, the size field is changed in instruction. */ extend instruction, the size field is changed in instruction. */
static unsigned long static unsigned long
get_data_from_address (unsigned short *inst, CORE_ADDR address) get_data_from_address (unsigned short *inst, CORE_ADDR address, enum bfd_endian byte_order)
{ {
int size = cris_get_size (*inst); int size = cris_get_size (*inst);
unsigned long value; unsigned long value;
@ -3410,7 +3427,7 @@ get_data_from_address (unsigned short *inst, CORE_ADDR address)
/* Is there a need for checking the size? Size should contain the number of /* Is there a need for checking the size? Size should contain the number of
bytes to read. */ bytes to read. */
size = 1 << size; size = 1 << size;
value = read_memory_unsigned_integer (address, size); value = read_memory_unsigned_integer (address, size, byte_order);
/* Check if it's an extend, signed or zero instruction. */ /* Check if it's an extend, signed or zero instruction. */
if (cris_get_opcode (*inst) < 4) if (cris_get_opcode (*inst) < 4)
@ -3436,7 +3453,8 @@ handle_prefix_assign_mode_for_aritm_op (unsigned short inst,
operand2 = inst_env->reg[REG_PC]; operand2 = inst_env->reg[REG_PC];
/* Get the value of the third operand. */ /* Get the value of the third operand. */
operand3 = get_data_from_address (&inst, inst_env->prefix_value); operand3 = get_data_from_address (&inst, inst_env->prefix_value,
inst_env->byte_order);
/* Calculate the PC value after the instruction, i.e. where the /* Calculate the PC value after the instruction, i.e. where the
breakpoint should be. The order of the udw_operands is vital. */ breakpoint should be. The order of the udw_operands is vital. */
@ -3465,7 +3483,8 @@ three_operand_add_sub_cmp_and_or_op (unsigned short inst,
operand2 = inst_env->reg[cris_get_operand2 (inst)]; operand2 = inst_env->reg[cris_get_operand2 (inst)];
/* Get the value of the third operand. */ /* Get the value of the third operand. */
operand3 = get_data_from_address (&inst, inst_env->prefix_value); operand3 = get_data_from_address (&inst, inst_env->prefix_value,
inst_env->byte_order);
/* Calculate the PC value after the instruction, i.e. where the /* Calculate the PC value after the instruction, i.e. where the
breakpoint should be. */ breakpoint should be. */
@ -3528,7 +3547,7 @@ handle_inc_and_index_mode_for_aritm_op (unsigned short inst,
/* Get the value of the third operand, i.e. the indirect operand. */ /* Get the value of the third operand, i.e. the indirect operand. */
operand1 = inst_env->reg[cris_get_operand1 (inst)]; operand1 = inst_env->reg[cris_get_operand1 (inst)];
operand3 = get_data_from_address (&inst, operand1); operand3 = get_data_from_address (&inst, operand1, inst_env->byte_order);
/* Calculate the PC value after the instruction, i.e. where the /* Calculate the PC value after the instruction, i.e. where the
breakpoint should be. The order of the udw_operands is vital. */ breakpoint should be. The order of the udw_operands is vital. */

View file

@ -1043,18 +1043,23 @@ enum { MAX_REGISTER_SIZE = 16 };
/* In findvar.c. */ /* In findvar.c. */
extern LONGEST extract_signed_integer (const gdb_byte *, int); extern LONGEST extract_signed_integer (const gdb_byte *, int,
enum bfd_endian);
extern ULONGEST extract_unsigned_integer (const gdb_byte *, int); extern ULONGEST extract_unsigned_integer (const gdb_byte *, int,
enum bfd_endian);
extern int extract_long_unsigned_integer (const gdb_byte *, int, LONGEST *); extern int extract_long_unsigned_integer (const gdb_byte *, int,
enum bfd_endian, LONGEST *);
extern CORE_ADDR extract_typed_address (const gdb_byte *buf, extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
struct type *type); struct type *type);
extern void store_signed_integer (gdb_byte *, int, LONGEST); extern void store_signed_integer (gdb_byte *, int,
enum bfd_endian, LONGEST);
extern void store_unsigned_integer (gdb_byte *, int, ULONGEST); extern void store_unsigned_integer (gdb_byte *, int,
enum bfd_endian, ULONGEST);
extern void store_typed_address (gdb_byte *buf, struct type *type, extern void store_typed_address (gdb_byte *buf, struct type *type,
CORE_ADDR addr); CORE_ADDR addr);

View file

@ -34,7 +34,8 @@
They are stored in host byte order. This routine does the conversion if They are stored in host byte order. This routine does the conversion if
the target byte order is different. */ the target byte order is different. */
static void static void
match_endianness (const gdb_byte *from, int len, gdb_byte *to) match_endianness (const gdb_byte *from, int len, enum bfd_endian byte_order,
gdb_byte *to)
{ {
int i; int i;
@ -44,7 +45,7 @@ match_endianness (const gdb_byte *from, int len, gdb_byte *to)
#define OPPOSITE_BYTE_ORDER BFD_ENDIAN_BIG #define OPPOSITE_BYTE_ORDER BFD_ENDIAN_BIG
#endif #endif
if (gdbarch_byte_order (current_gdbarch) == OPPOSITE_BYTE_ORDER) if (byte_order == OPPOSITE_BYTE_ORDER)
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
to[i] = from[len - i - 1]; to[i] = from[len - i - 1];
else else
@ -141,11 +142,12 @@ decimal_to_number (const gdb_byte *from, int len, decNumber *to)
of the decimal type, 4 bytes for decimal32, 8 bytes for decimal64 and of the decimal type, 4 bytes for decimal32, 8 bytes for decimal64 and
16 bytes for decimal128. */ 16 bytes for decimal128. */
void void
decimal_to_string (const gdb_byte *decbytes, int len, char *s) decimal_to_string (const gdb_byte *decbytes, int len,
enum bfd_endian byte_order, char *s)
{ {
gdb_byte dec[16]; gdb_byte dec[16];
match_endianness (decbytes, len, dec); match_endianness (decbytes, len, byte_order, dec);
switch (len) switch (len)
{ {
@ -168,7 +170,8 @@ decimal_to_string (const gdb_byte *decbytes, int len, char *s)
LEN is the length of the decimal type, 4 bytes for decimal32, 8 bytes for LEN is the length of the decimal type, 4 bytes for decimal32, 8 bytes for
decimal64 and 16 bytes for decimal128. */ decimal64 and 16 bytes for decimal128. */
int int
decimal_from_string (gdb_byte *decbytes, int len, const char *string) decimal_from_string (gdb_byte *decbytes, int len, enum bfd_endian byte_order,
const char *string)
{ {
decContext set; decContext set;
gdb_byte dec[16]; gdb_byte dec[16];
@ -191,7 +194,7 @@ decimal_from_string (gdb_byte *decbytes, int len, const char *string)
break; break;
} }
match_endianness (dec, len, decbytes); match_endianness (dec, len, byte_order, decbytes);
/* Check for errors in the DFP operation. */ /* Check for errors in the DFP operation. */
decimal_check_errors (&set); decimal_check_errors (&set);
@ -202,7 +205,8 @@ decimal_from_string (gdb_byte *decbytes, int len, const char *string)
/* Converts a value of an integral type to a decimal float of /* Converts a value of an integral type to a decimal float of
specified LEN bytes. */ specified LEN bytes. */
void void
decimal_from_integral (struct value *from, gdb_byte *to, int len) decimal_from_integral (struct value *from,
gdb_byte *to, int len, enum bfd_endian byte_order)
{ {
LONGEST l; LONGEST l;
gdb_byte dec[16]; gdb_byte dec[16];
@ -223,7 +227,7 @@ decimal_from_integral (struct value *from, gdb_byte *to, int len)
decNumberFromInt32 (&number, (int) l); decNumberFromInt32 (&number, (int) l);
decimal_from_number (&number, dec, len); decimal_from_number (&number, dec, len);
match_endianness (dec, len, to); match_endianness (dec, len, byte_order, to);
} }
/* Converts a value of a float type to a decimal float of /* Converts a value of a float type to a decimal float of
@ -232,41 +236,46 @@ decimal_from_integral (struct value *from, gdb_byte *to, int len)
This is an ugly way to do the conversion, but libdecnumber does This is an ugly way to do the conversion, but libdecnumber does
not offer a direct way to do it. */ not offer a direct way to do it. */
void void
decimal_from_floating (struct value *from, gdb_byte *to, int len) decimal_from_floating (struct value *from,
gdb_byte *to, int len, enum bfd_endian byte_order)
{ {
char *buffer; char *buffer;
buffer = xstrprintf ("%.30" DOUBLEST_PRINT_FORMAT, value_as_double (from)); buffer = xstrprintf ("%.30" DOUBLEST_PRINT_FORMAT, value_as_double (from));
decimal_from_string (to, len, buffer); decimal_from_string (to, len, byte_order, buffer);
xfree (buffer); xfree (buffer);
} }
/* Converts a decimal float of LEN bytes to a double value. */ /* Converts a decimal float of LEN bytes to a double value. */
DOUBLEST DOUBLEST
decimal_to_doublest (const gdb_byte *from, int len) decimal_to_doublest (const gdb_byte *from, int len, enum bfd_endian byte_order)
{ {
char buffer[MAX_DECIMAL_STRING]; char buffer[MAX_DECIMAL_STRING];
/* This is an ugly way to do the conversion, but libdecnumber does /* This is an ugly way to do the conversion, but libdecnumber does
not offer a direct way to do it. */ not offer a direct way to do it. */
decimal_to_string (from, len, buffer); decimal_to_string (from, len, byte_order, buffer);
return strtod (buffer, NULL); return strtod (buffer, NULL);
} }
/* Perform operation OP with operands X and Y with sizes LEN_X and LEN_Y /* Perform operation OP with operands X and Y with sizes LEN_X and LEN_Y
and store value in RESULT with size LEN_RESULT. */ and byte orders BYTE_ORDER_X and BYTE_ORDER_Y, and store value in
RESULT with size LEN_RESULT and byte order BYTE_ORDER_RESULT. */
void void
decimal_binop (enum exp_opcode op, const gdb_byte *x, int len_x, decimal_binop (enum exp_opcode op,
const gdb_byte *y, int len_y, gdb_byte *result, int len_result) const gdb_byte *x, int len_x, enum bfd_endian byte_order_x,
const gdb_byte *y, int len_y, enum bfd_endian byte_order_y,
gdb_byte *result, int len_result,
enum bfd_endian byte_order_result)
{ {
decContext set; decContext set;
decNumber number1, number2, number3; decNumber number1, number2, number3;
gdb_byte dec1[16], dec2[16], dec3[16]; gdb_byte dec1[16], dec2[16], dec3[16];
match_endianness (x, len_x, dec1); match_endianness (x, len_x, byte_order_x, dec1);
match_endianness (y, len_y, dec2); match_endianness (y, len_y, byte_order_y, dec2);
decimal_to_number (dec1, len_x, &number1); decimal_to_number (dec1, len_x, &number1);
decimal_to_number (dec2, len_y, &number2); decimal_to_number (dec2, len_y, &number2);
@ -301,17 +310,17 @@ decimal_binop (enum exp_opcode op, const gdb_byte *x, int len_x,
decimal_from_number (&number3, dec3, len_result); decimal_from_number (&number3, dec3, len_result);
match_endianness (dec3, len_result, result); match_endianness (dec3, len_result, byte_order_result, result);
} }
/* Returns true if X (which is LEN bytes wide) is the number zero. */ /* Returns true if X (which is LEN bytes wide) is the number zero. */
int int
decimal_is_zero (const gdb_byte *x, int len) decimal_is_zero (const gdb_byte *x, int len, enum bfd_endian byte_order)
{ {
decNumber number; decNumber number;
gdb_byte dec[16]; gdb_byte dec[16];
match_endianness (x, len, dec); match_endianness (x, len, byte_order, dec);
decimal_to_number (dec, len, &number); decimal_to_number (dec, len, &number);
return decNumberIsZero (&number); return decNumberIsZero (&number);
@ -321,15 +330,16 @@ decimal_is_zero (const gdb_byte *x, int len)
will be -1. If they are equal, then the return value will be 0. If X is will be -1. If they are equal, then the return value will be 0. If X is
greater than the Y then the return value will be 1. */ greater than the Y then the return value will be 1. */
int int
decimal_compare (const gdb_byte *x, int len_x, const gdb_byte *y, int len_y) decimal_compare (const gdb_byte *x, int len_x, enum bfd_endian byte_order_x,
const gdb_byte *y, int len_y, enum bfd_endian byte_order_y)
{ {
decNumber number1, number2, result; decNumber number1, number2, result;
decContext set; decContext set;
gdb_byte dec1[16], dec2[16]; gdb_byte dec1[16], dec2[16];
int len_result; int len_result;
match_endianness (x, len_x, dec1); match_endianness (x, len_x, byte_order_x, dec1);
match_endianness (y, len_y, dec2); match_endianness (y, len_y, byte_order_y, dec2);
decimal_to_number (dec1, len_x, &number1); decimal_to_number (dec1, len_x, &number1);
decimal_to_number (dec2, len_y, &number2); decimal_to_number (dec2, len_y, &number2);
@ -356,16 +366,17 @@ decimal_compare (const gdb_byte *x, int len_x, const gdb_byte *y, int len_y)
/* Convert a decimal value from a decimal type with LEN_FROM bytes to a /* Convert a decimal value from a decimal type with LEN_FROM bytes to a
decimal type with LEN_TO bytes. */ decimal type with LEN_TO bytes. */
void void
decimal_convert (const gdb_byte *from, int len_from, gdb_byte *to, decimal_convert (const gdb_byte *from, int len_from,
int len_to) enum bfd_endian byte_order_from, gdb_byte *to, int len_to,
enum bfd_endian byte_order_to)
{ {
decNumber number; decNumber number;
gdb_byte dec[16]; gdb_byte dec[16];
match_endianness (from, len_from, dec); match_endianness (from, len_from, byte_order_from, dec);
decimal_to_number (dec, len_from, &number); decimal_to_number (dec, len_from, &number);
decimal_from_number (&number, dec, len_to); decimal_from_number (&number, dec, len_to);
match_endianness (dec, len_to, to); match_endianness (dec, len_to, byte_order_to, to);
} }

View file

@ -29,16 +29,22 @@
* (value comes from libdecnumber's DECIMAL128_String constant). */ * (value comes from libdecnumber's DECIMAL128_String constant). */
#define MAX_DECIMAL_STRING 43 #define MAX_DECIMAL_STRING 43
extern void decimal_to_string (const gdb_byte *, int, char *); extern void decimal_to_string (const gdb_byte *, int, enum bfd_endian, char *);
extern int decimal_from_string (gdb_byte *, int, const char *); extern int decimal_from_string (gdb_byte *, int, enum bfd_endian, const char *);
extern void decimal_from_integral (struct value *from, gdb_byte *to, int len); extern void decimal_from_integral (struct value *from, gdb_byte *to,
extern void decimal_from_floating (struct value *from, gdb_byte *to, int len); int len, enum bfd_endian byte_order);
extern DOUBLEST decimal_to_doublest (const gdb_byte *from, int len); extern void decimal_from_floating (struct value *from, gdb_byte *to,
extern void decimal_binop (enum exp_opcode, const gdb_byte *, int, int len, enum bfd_endian byte_order);
const gdb_byte *, int, gdb_byte *, int); extern DOUBLEST decimal_to_doublest (const gdb_byte *from, int len,
extern int decimal_is_zero (const gdb_byte *x, int len); enum bfd_endian byte_order);
extern int decimal_compare (const gdb_byte *x, int len_x, const gdb_byte *y, int len_y); extern void decimal_binop (enum exp_opcode,
extern void decimal_convert (const gdb_byte *from, int len_from, gdb_byte *to, const gdb_byte *, int, enum bfd_endian,
int len_to); const gdb_byte *, int, enum bfd_endian,
gdb_byte *, int, enum bfd_endian);
extern int decimal_is_zero (const gdb_byte *, int, enum bfd_endian);
extern int decimal_compare (const gdb_byte *, int, enum bfd_endian,
const gdb_byte *, int, enum bfd_endian);
extern void decimal_convert (const gdb_byte *, int, enum bfd_endian,
gdb_byte *, int, enum bfd_endian);
#endif #endif

View file

@ -379,6 +379,7 @@ execute_cfa_program (struct dwarf2_fde *fde, gdb_byte *insn_ptr,
CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR pc = get_frame_pc (this_frame);
int bytes_read; int bytes_read;
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);
while (insn_ptr < insn_end && fs->pc <= pc) while (insn_ptr < insn_end && fs->pc <= pc)
{ {
@ -418,17 +419,17 @@ execute_cfa_program (struct dwarf2_fde *fde, gdb_byte *insn_ptr,
break; break;
case DW_CFA_advance_loc1: case DW_CFA_advance_loc1:
utmp = extract_unsigned_integer (insn_ptr, 1); utmp = extract_unsigned_integer (insn_ptr, 1, byte_order);
fs->pc += utmp * fs->code_align; fs->pc += utmp * fs->code_align;
insn_ptr++; insn_ptr++;
break; break;
case DW_CFA_advance_loc2: case DW_CFA_advance_loc2:
utmp = extract_unsigned_integer (insn_ptr, 2); utmp = extract_unsigned_integer (insn_ptr, 2, byte_order);
fs->pc += utmp * fs->code_align; fs->pc += utmp * fs->code_align;
insn_ptr += 2; insn_ptr += 2;
break; break;
case DW_CFA_advance_loc4: case DW_CFA_advance_loc4:
utmp = extract_unsigned_integer (insn_ptr, 4); utmp = extract_unsigned_integer (insn_ptr, 4, byte_order);
fs->pc += utmp * fs->code_align; fs->pc += utmp * fs->code_align;
insn_ptr += 4; insn_ptr += 4;
break; break;

View file

@ -207,6 +207,7 @@ CORE_ADDR
dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf, dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf,
gdb_byte *buf_end, int addr_size) gdb_byte *buf_end, int addr_size)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR result; CORE_ADDR result;
if (buf_end - buf < addr_size) if (buf_end - buf < addr_size)
@ -227,7 +228,7 @@ dwarf2_read_address (struct gdbarch *gdbarch, gdb_byte *buf,
return gdbarch_integer_to_address return gdbarch_integer_to_address
(gdbarch, unsigned_address_type (gdbarch, addr_size), buf); (gdbarch, unsigned_address_type (gdbarch, addr_size), buf);
return extract_unsigned_integer (buf, addr_size); return extract_unsigned_integer (buf, addr_size, byte_order);
} }
/* Return the type of an address of size ADDR_SIZE, /* Return the type of an address of size ADDR_SIZE,
@ -277,6 +278,8 @@ static void
execute_stack_op (struct dwarf_expr_context *ctx, execute_stack_op (struct dwarf_expr_context *ctx,
gdb_byte *op_ptr, gdb_byte *op_end) gdb_byte *op_ptr, gdb_byte *op_end)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (ctx->gdbarch);
ctx->in_reg = 0; ctx->in_reg = 0;
ctx->initialized = 1; /* Default is initialized. */ ctx->initialized = 1; /* Default is initialized. */
@ -336,35 +339,35 @@ execute_stack_op (struct dwarf_expr_context *ctx,
break; break;
case DW_OP_const1u: case DW_OP_const1u:
result = extract_unsigned_integer (op_ptr, 1); result = extract_unsigned_integer (op_ptr, 1, byte_order);
op_ptr += 1; op_ptr += 1;
break; break;
case DW_OP_const1s: case DW_OP_const1s:
result = extract_signed_integer (op_ptr, 1); result = extract_signed_integer (op_ptr, 1, byte_order);
op_ptr += 1; op_ptr += 1;
break; break;
case DW_OP_const2u: case DW_OP_const2u:
result = extract_unsigned_integer (op_ptr, 2); result = extract_unsigned_integer (op_ptr, 2, byte_order);
op_ptr += 2; op_ptr += 2;
break; break;
case DW_OP_const2s: case DW_OP_const2s:
result = extract_signed_integer (op_ptr, 2); result = extract_signed_integer (op_ptr, 2, byte_order);
op_ptr += 2; op_ptr += 2;
break; break;
case DW_OP_const4u: case DW_OP_const4u:
result = extract_unsigned_integer (op_ptr, 4); result = extract_unsigned_integer (op_ptr, 4, byte_order);
op_ptr += 4; op_ptr += 4;
break; break;
case DW_OP_const4s: case DW_OP_const4s:
result = extract_signed_integer (op_ptr, 4); result = extract_signed_integer (op_ptr, 4, byte_order);
op_ptr += 4; op_ptr += 4;
break; break;
case DW_OP_const8u: case DW_OP_const8u:
result = extract_unsigned_integer (op_ptr, 8); result = extract_unsigned_integer (op_ptr, 8, byte_order);
op_ptr += 8; op_ptr += 8;
break; break;
case DW_OP_const8s: case DW_OP_const8s:
result = extract_signed_integer (op_ptr, 8); result = extract_signed_integer (op_ptr, 8, byte_order);
op_ptr += 8; op_ptr += 8;
break; break;
case DW_OP_constu: case DW_OP_constu:
@ -712,13 +715,13 @@ execute_stack_op (struct dwarf_expr_context *ctx,
break; break;
case DW_OP_skip: case DW_OP_skip:
offset = extract_signed_integer (op_ptr, 2); offset = extract_signed_integer (op_ptr, 2, byte_order);
op_ptr += 2; op_ptr += 2;
op_ptr += offset; op_ptr += offset;
goto no_push; goto no_push;
case DW_OP_bra: case DW_OP_bra:
offset = extract_signed_integer (op_ptr, 2); offset = extract_signed_integer (op_ptr, 2, byte_order);
op_ptr += 2; op_ptr += 2;
if (dwarf_expr_fetch (ctx, 0) != 0) if (dwarf_expr_fetch (ctx, 0) != 0)
op_ptr += offset; op_ptr += offset;

View file

@ -57,6 +57,7 @@ find_location_expression (struct dwarf2_loclist_baton *baton,
int length; int length;
struct objfile *objfile = dwarf2_per_cu_objfile (baton->per_cu); struct objfile *objfile = dwarf2_per_cu_objfile (baton->per_cu);
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int addr_size = dwarf2_per_cu_addr_size (baton->per_cu); unsigned int addr_size = dwarf2_per_cu_addr_size (baton->per_cu);
CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1)); CORE_ADDR base_mask = ~(~(CORE_ADDR)1 << (addr_size * 8 - 1));
/* Adjust base_address for relocatable objects. */ /* Adjust base_address for relocatable objects. */
@ -89,7 +90,7 @@ find_location_expression (struct dwarf2_loclist_baton *baton,
low += base_address; low += base_address;
high += base_address; high += base_address;
length = extract_unsigned_integer (loc_ptr, 2); length = extract_unsigned_integer (loc_ptr, 2, byte_order);
loc_ptr += 2; loc_ptr += 2;
if (pc >= low && pc < high) if (pc >= low && pc < high)

View file

@ -8076,6 +8076,8 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym,
{ {
struct objfile *objfile = cu->objfile; struct objfile *objfile = cu->objfile;
struct comp_unit_head *cu_header = &cu->header; struct comp_unit_head *cu_header = &cu->header;
enum bfd_endian byte_order = bfd_big_endian (objfile->obfd) ?
BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
struct dwarf_block *blk; struct dwarf_block *blk;
switch (attr->form) switch (attr->form)
@ -8091,7 +8093,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym,
/* NOTE: cagney/2003-05-09: In-lined store_address call with /* NOTE: cagney/2003-05-09: In-lined store_address call with
it's body - store_unsigned_integer. */ it's body - store_unsigned_integer. */
store_unsigned_integer (SYMBOL_VALUE_BYTES (sym), cu_header->addr_size, store_unsigned_integer (SYMBOL_VALUE_BYTES (sym), cu_header->addr_size,
DW_ADDR (attr)); DW_ADDR (attr), byte_order);
SYMBOL_CLASS (sym) = LOC_CONST_BYTES; SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
break; break;
case DW_FORM_string: case DW_FORM_string:

View file

@ -246,6 +246,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct gdbarch *gdbarch = get_type_arch (type); struct gdbarch *gdbarch = get_type_arch (type);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int i = 0; /* Number of characters printed */ unsigned int i = 0; /* Number of characters printed */
struct type *elttype; struct type *elttype;
LONGEST val; LONGEST val;
@ -409,8 +410,8 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
} }
else else
{ {
val = extract_unsigned_integer (valaddr, TYPE_LENGTH (type)); val = extract_unsigned_integer (valaddr,
TYPE_LENGTH (type), byte_order);
if (val == 0) if (val == 0)
fprintf_filtered (stream, ".FALSE."); fprintf_filtered (stream, ".FALSE.");
else if (val == 1) else if (val == 1)

View file

@ -48,7 +48,8 @@ you lose
#endif #endif
LONGEST LONGEST
extract_signed_integer (const gdb_byte *addr, int len) extract_signed_integer (const gdb_byte *addr, int len,
enum bfd_endian byte_order)
{ {
LONGEST retval; LONGEST retval;
const unsigned char *p; const unsigned char *p;
@ -62,7 +63,7 @@ That operation is not available on integers of more than %d bytes."),
/* Start at the most significant end of the integer, and work towards /* Start at the most significant end of the integer, and work towards
the least significant. */ the least significant. */
if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) if (byte_order == BFD_ENDIAN_BIG)
{ {
p = startaddr; p = startaddr;
/* Do the sign extension once at the start. */ /* Do the sign extension once at the start. */
@ -82,7 +83,8 @@ That operation is not available on integers of more than %d bytes."),
} }
ULONGEST ULONGEST
extract_unsigned_integer (const gdb_byte *addr, int len) extract_unsigned_integer (const gdb_byte *addr, int len,
enum bfd_endian byte_order)
{ {
ULONGEST retval; ULONGEST retval;
const unsigned char *p; const unsigned char *p;
@ -97,7 +99,7 @@ That operation is not available on integers of more than %d bytes."),
/* Start at the most significant end of the integer, and work towards /* Start at the most significant end of the integer, and work towards
the least significant. */ the least significant. */
retval = 0; retval = 0;
if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) if (byte_order == BFD_ENDIAN_BIG)
{ {
for (p = startaddr; p < endaddr; ++p) for (p = startaddr; p < endaddr; ++p)
retval = (retval << 8) | *p; retval = (retval << 8) | *p;
@ -117,14 +119,14 @@ That operation is not available on integers of more than %d bytes."),
int int
extract_long_unsigned_integer (const gdb_byte *addr, int orig_len, extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
LONGEST *pval) enum bfd_endian byte_order, LONGEST *pval)
{ {
const gdb_byte *p; const gdb_byte *p;
const gdb_byte *first_addr; const gdb_byte *first_addr;
int len; int len;
len = orig_len; len = orig_len;
if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) if (byte_order == BFD_ENDIAN_BIG)
{ {
for (p = addr; for (p = addr;
len > (int) sizeof (LONGEST) && p < addr + orig_len; len > (int) sizeof (LONGEST) && p < addr + orig_len;
@ -154,7 +156,8 @@ extract_long_unsigned_integer (const gdb_byte *addr, int orig_len,
if (len <= (int) sizeof (LONGEST)) if (len <= (int) sizeof (LONGEST))
{ {
*pval = (LONGEST) extract_unsigned_integer (first_addr, *pval = (LONGEST) extract_unsigned_integer (first_addr,
sizeof (LONGEST)); sizeof (LONGEST),
byte_order);
return 1; return 1;
} }
@ -178,7 +181,8 @@ extract_typed_address (const gdb_byte *buf, struct type *type)
void void
store_signed_integer (gdb_byte *addr, int len, LONGEST val) store_signed_integer (gdb_byte *addr, int len,
enum bfd_endian byte_order, LONGEST val)
{ {
gdb_byte *p; gdb_byte *p;
gdb_byte *startaddr = addr; gdb_byte *startaddr = addr;
@ -186,7 +190,7 @@ store_signed_integer (gdb_byte *addr, int len, LONGEST val)
/* Start at the least significant end of the integer, and work towards /* Start at the least significant end of the integer, and work towards
the most significant. */ the most significant. */
if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) if (byte_order == BFD_ENDIAN_BIG)
{ {
for (p = endaddr - 1; p >= startaddr; --p) for (p = endaddr - 1; p >= startaddr; --p)
{ {
@ -205,7 +209,8 @@ store_signed_integer (gdb_byte *addr, int len, LONGEST val)
} }
void void
store_unsigned_integer (gdb_byte *addr, int len, ULONGEST val) store_unsigned_integer (gdb_byte *addr, int len,
enum bfd_endian byte_order, ULONGEST val)
{ {
unsigned char *p; unsigned char *p;
unsigned char *startaddr = (unsigned char *) addr; unsigned char *startaddr = (unsigned char *) addr;
@ -213,7 +218,7 @@ store_unsigned_integer (gdb_byte *addr, int len, ULONGEST val)
/* Start at the least significant end of the integer, and work towards /* Start at the least significant end of the integer, and work towards
the most significant. */ the most significant. */
if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) if (byte_order == BFD_ENDIAN_BIG)
{ {
for (p = endaddr - 1; p >= startaddr; --p) for (p = endaddr - 1; p >= startaddr; --p)
{ {
@ -312,14 +317,16 @@ CORE_ADDR
unsigned_pointer_to_address (struct gdbarch *gdbarch, unsigned_pointer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf) struct type *type, const gdb_byte *buf)
{ {
return extract_unsigned_integer (buf, TYPE_LENGTH (type)); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
return extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
} }
CORE_ADDR CORE_ADDR
signed_pointer_to_address (struct gdbarch *gdbarch, signed_pointer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf) struct type *type, const gdb_byte *buf)
{ {
return extract_signed_integer (buf, TYPE_LENGTH (type)); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
return extract_signed_integer (buf, TYPE_LENGTH (type), byte_order);
} }
/* Given an address, store it as a pointer of type TYPE in target /* Given an address, store it as a pointer of type TYPE in target
@ -328,14 +335,16 @@ void
unsigned_address_to_pointer (struct gdbarch *gdbarch, struct type *type, unsigned_address_to_pointer (struct gdbarch *gdbarch, struct type *type,
gdb_byte *buf, CORE_ADDR addr) gdb_byte *buf, CORE_ADDR addr)
{ {
store_unsigned_integer (buf, TYPE_LENGTH (type), addr); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
} }
void void
address_to_signed_pointer (struct gdbarch *gdbarch, struct type *type, address_to_signed_pointer (struct gdbarch *gdbarch, struct type *type,
gdb_byte *buf, CORE_ADDR addr) gdb_byte *buf, CORE_ADDR addr)
{ {
store_signed_integer (buf, TYPE_LENGTH (type), addr); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
store_signed_integer (buf, TYPE_LENGTH (type), byte_order, addr);
} }
/* Will calling read_var_value or locate_var_value on SYM end /* Will calling read_var_value or locate_var_value on SYM end
@ -415,6 +424,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_CONST: case LOC_CONST:
/* Put the constant back in target format. */ /* Put the constant back in target format. */
store_signed_integer (value_contents_raw (v), len, store_signed_integer (value_contents_raw (v), len,
gdbarch_byte_order (get_type_arch (type)),
(LONGEST) SYMBOL_VALUE (var)); (LONGEST) SYMBOL_VALUE (var));
VALUE_LVAL (v) = not_lval; VALUE_LVAL (v) = not_lval;
return v; return v;

View file

@ -165,11 +165,12 @@ frame_unwind_got_constant (struct frame_info *frame, int regnum,
ULONGEST val) ULONGEST val)
{ {
struct gdbarch *gdbarch = frame_unwind_arch (frame); struct gdbarch *gdbarch = frame_unwind_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct value *reg_val; struct value *reg_val;
reg_val = value_zero (register_type (gdbarch, regnum), not_lval); reg_val = value_zero (register_type (gdbarch, regnum), not_lval);
store_unsigned_integer (value_contents_writeable (reg_val), store_unsigned_integer (value_contents_writeable (reg_val),
register_size (gdbarch, regnum), val); register_size (gdbarch, regnum), byte_order, val);
return reg_val; return reg_val;
} }

View file

@ -810,10 +810,12 @@ get_frame_register_value (struct frame_info *frame, int regnum)
LONGEST LONGEST
frame_unwind_register_signed (struct frame_info *frame, int regnum) frame_unwind_register_signed (struct frame_info *frame, int regnum)
{ {
struct gdbarch *gdbarch = frame_unwind_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, regnum);
gdb_byte buf[MAX_REGISTER_SIZE]; gdb_byte buf[MAX_REGISTER_SIZE];
frame_unwind_register (frame, regnum, buf); frame_unwind_register (frame, regnum, buf);
return extract_signed_integer (buf, register_size (frame_unwind_arch (frame), return extract_signed_integer (buf, size, byte_order);
regnum));
} }
LONGEST LONGEST
@ -825,10 +827,12 @@ get_frame_register_signed (struct frame_info *frame, int regnum)
ULONGEST ULONGEST
frame_unwind_register_unsigned (struct frame_info *frame, int regnum) frame_unwind_register_unsigned (struct frame_info *frame, int regnum)
{ {
struct gdbarch *gdbarch = frame_unwind_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, regnum);
gdb_byte buf[MAX_REGISTER_SIZE]; gdb_byte buf[MAX_REGISTER_SIZE];
frame_unwind_register (frame, regnum, buf); frame_unwind_register (frame, regnum, buf);
return extract_unsigned_integer (buf, register_size (frame_unwind_arch (frame), return extract_unsigned_integer (buf, size, byte_order);
regnum));
} }
ULONGEST ULONGEST
@ -1874,14 +1878,18 @@ LONGEST
get_frame_memory_signed (struct frame_info *this_frame, CORE_ADDR addr, get_frame_memory_signed (struct frame_info *this_frame, CORE_ADDR addr,
int len) int len)
{ {
return read_memory_integer (addr, len); struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
return read_memory_integer (addr, len, byte_order);
} }
ULONGEST ULONGEST
get_frame_memory_unsigned (struct frame_info *this_frame, CORE_ADDR addr, get_frame_memory_unsigned (struct frame_info *this_frame, CORE_ADDR addr,
int len) int len)
{ {
return read_memory_unsigned_integer (addr, len); struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
return read_memory_unsigned_integer (addr, len, byte_order);
} }
int int

View file

@ -41,8 +41,9 @@ enum {
}; };
static int static int
frv_linux_pc_in_sigtramp (CORE_ADDR pc, char *name) frv_linux_pc_in_sigtramp (struct gdbarch *gdbarch, CORE_ADDR pc, char *name)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
char buf[frv_instr_size]; char buf[frv_instr_size];
LONGEST instr; LONGEST instr;
int retval = 0; int retval = 0;
@ -50,7 +51,7 @@ frv_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
if (target_read_memory (pc, buf, sizeof buf) != 0) if (target_read_memory (pc, buf, sizeof buf) != 0)
return 0; return 0;
instr = extract_unsigned_integer (buf, sizeof buf); instr = extract_unsigned_integer (buf, sizeof buf, byte_order);
if (instr == 0x8efc0077) /* setlos #__NR_sigreturn, gr7 */ if (instr == 0x8efc0077) /* setlos #__NR_sigreturn, gr7 */
retval = NORMAL_SIGTRAMP; retval = NORMAL_SIGTRAMP;
@ -61,7 +62,7 @@ frv_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
if (target_read_memory (pc + frv_instr_size, buf, sizeof buf) != 0) if (target_read_memory (pc + frv_instr_size, buf, sizeof buf) != 0)
return 0; return 0;
instr = extract_unsigned_integer (buf, sizeof buf); instr = extract_unsigned_integer (buf, sizeof buf, byte_order);
if (instr != 0xc0700000) /* tira gr0, 0 */ if (instr != 0xc0700000) /* tira gr0, 0 */
return 0; return 0;
@ -168,6 +169,8 @@ static LONGEST
frv_linux_sigcontext_reg_addr (struct frame_info *this_frame, int regno, frv_linux_sigcontext_reg_addr (struct frame_info *this_frame, int regno,
CORE_ADDR *sc_addr_cache_ptr) CORE_ADDR *sc_addr_cache_ptr)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sc_addr; CORE_ADDR sc_addr;
if (sc_addr_cache_ptr && *sc_addr_cache_ptr) if (sc_addr_cache_ptr && *sc_addr_cache_ptr)
@ -181,10 +184,10 @@ frv_linux_sigcontext_reg_addr (struct frame_info *this_frame, int regno,
int tramp_type; int tramp_type;
pc = get_frame_pc (this_frame); pc = get_frame_pc (this_frame);
tramp_type = frv_linux_pc_in_sigtramp (pc, 0); tramp_type = frv_linux_pc_in_sigtramp (gdbarch, pc, 0);
get_frame_register (this_frame, sp_regnum, buf); get_frame_register (this_frame, sp_regnum, buf);
sp = extract_unsigned_integer (buf, sizeof buf); sp = extract_unsigned_integer (buf, sizeof buf, byte_order);
if (tramp_type == NORMAL_SIGTRAMP) if (tramp_type == NORMAL_SIGTRAMP)
{ {
@ -206,7 +209,7 @@ frv_linux_sigcontext_reg_addr (struct frame_info *this_frame, int regno,
warning (_("Can't read realtime sigtramp frame.")); warning (_("Can't read realtime sigtramp frame."));
return 0; return 0;
} }
sc_addr = extract_unsigned_integer (buf, sizeof buf); sc_addr = extract_unsigned_integer (buf, sizeof buf, byte_order);
sc_addr += 24; sc_addr += 24;
} }
else else
@ -255,8 +258,10 @@ frv_linux_sigcontext_reg_addr (struct frame_info *this_frame, int regno,
static struct trad_frame_cache * static struct trad_frame_cache *
frv_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) frv_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct trad_frame_cache *cache; struct trad_frame_cache *cache;
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
CORE_ADDR addr; CORE_ADDR addr;
char buf[4]; char buf[4];
int regnum; int regnum;
@ -273,8 +278,8 @@ frv_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache
signal trampoline and not the current PC within that signal trampoline and not the current PC within that
trampoline. */ trampoline. */
get_frame_register (this_frame, sp_regnum, buf); get_frame_register (this_frame, sp_regnum, buf);
this_id = frame_id_build (extract_unsigned_integer (buf, sizeof buf), addr = extract_unsigned_integer (buf, sizeof buf, byte_order);
get_frame_pc (this_frame)); this_id = frame_id_build (addr, get_frame_pc (this_frame));
trad_frame_set_id (cache, this_id); trad_frame_set_id (cache, this_id);
for (regnum = 0; regnum < frv_num_regs; regnum++) for (regnum = 0; regnum < frv_num_regs; regnum++)
@ -313,11 +318,12 @@ frv_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame, struct frame_info *this_frame,
void **this_cache) void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR pc = get_frame_pc (this_frame);
char *name; char *name;
find_pc_partial_function (pc, &name, NULL, NULL); find_pc_partial_function (pc, &name, NULL, NULL);
if (frv_linux_pc_in_sigtramp (pc, name)) if (frv_linux_pc_in_sigtramp (gdbarch, pc, name))
return 1; return 1;
return 0; return 0;

View file

@ -514,6 +514,8 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
struct frame_info *this_frame, struct frame_info *this_frame,
struct frv_unwind_cache *info) struct frv_unwind_cache *info)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* When writing out instruction bitpatterns, we use the following /* When writing out instruction bitpatterns, we use the following
letters to label instruction fields: letters to label instruction fields:
P - The parallel bit. We don't use this. P - The parallel bit. We don't use this.
@ -595,7 +597,7 @@ frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
if (target_read_memory (pc, buf, sizeof buf) != 0) if (target_read_memory (pc, buf, sizeof buf) != 0)
break; break;
op = extract_signed_integer (buf, sizeof buf); op = extract_signed_integer (buf, sizeof buf, byte_order);
next_pc = pc + 4; next_pc = pc + 4;
@ -1007,13 +1009,14 @@ frv_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
static CORE_ADDR static CORE_ADDR
frv_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) frv_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[4]; gdb_byte buf[4];
unsigned long op; unsigned long op;
CORE_ADDR orig_pc = pc; CORE_ADDR orig_pc = pc;
if (target_read_memory (pc, buf, 4)) if (target_read_memory (pc, buf, 4))
return pc; return pc;
op = extract_unsigned_integer (buf, 4); op = extract_unsigned_integer (buf, 4, byte_order);
/* In PIC code, GR15 may be loaded from some offset off of FP prior /* In PIC code, GR15 may be loaded from some offset off of FP prior
to the call instruction. to the call instruction.
@ -1041,7 +1044,7 @@ frv_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
pc += 4; pc += 4;
if (target_read_memory (pc, buf, 4)) if (target_read_memory (pc, buf, 4))
return orig_pc; return orig_pc;
op = extract_unsigned_integer (buf, 4); op = extract_unsigned_integer (buf, 4, byte_order);
} }
/* The format of an FRV CALL instruction is as follows: /* The format of an FRV CALL instruction is as follows:
@ -1106,21 +1109,23 @@ static void
frv_extract_return_value (struct type *type, struct regcache *regcache, frv_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf) gdb_byte *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
if (len <= 4) if (len <= 4)
{ {
ULONGEST gpr8_val; ULONGEST gpr8_val;
regcache_cooked_read_unsigned (regcache, 8, &gpr8_val); regcache_cooked_read_unsigned (regcache, 8, &gpr8_val);
store_unsigned_integer (valbuf, len, gpr8_val); store_unsigned_integer (valbuf, len, byte_order, gpr8_val);
} }
else if (len == 8) else if (len == 8)
{ {
ULONGEST regval; ULONGEST regval;
regcache_cooked_read_unsigned (regcache, 8, &regval); regcache_cooked_read_unsigned (regcache, 8, &regval);
store_unsigned_integer (valbuf, 4, regval); store_unsigned_integer (valbuf, 4, byte_order, regval);
regcache_cooked_read_unsigned (regcache, 9, &regval); regcache_cooked_read_unsigned (regcache, 9, &regval);
store_unsigned_integer ((bfd_byte *) valbuf + 4, 4, regval); store_unsigned_integer ((bfd_byte *) valbuf + 4, 4, byte_order, regval);
} }
else else
internal_error (__FILE__, __LINE__, _("Illegal return value length: %d"), len); internal_error (__FILE__, __LINE__, _("Illegal return value length: %d"), len);
@ -1136,6 +1141,7 @@ frv_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
static CORE_ADDR static CORE_ADDR
find_func_descr (struct gdbarch *gdbarch, CORE_ADDR entry_point) find_func_descr (struct gdbarch *gdbarch, CORE_ADDR entry_point)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR descr; CORE_ADDR descr;
char valbuf[4]; char valbuf[4];
CORE_ADDR start_addr; CORE_ADDR start_addr;
@ -1155,9 +1161,9 @@ find_func_descr (struct gdbarch *gdbarch, CORE_ADDR entry_point)
the stack. */ the stack. */
descr = value_as_long (value_allocate_space_in_inferior (8)); descr = value_as_long (value_allocate_space_in_inferior (8));
store_unsigned_integer (valbuf, 4, entry_point); store_unsigned_integer (valbuf, 4, byte_order, entry_point);
write_memory (descr, valbuf, 4); write_memory (descr, valbuf, 4);
store_unsigned_integer (valbuf, 4, store_unsigned_integer (valbuf, 4, byte_order,
frv_fdpic_find_global_pointer (entry_point)); frv_fdpic_find_global_pointer (entry_point));
write_memory (descr + 4, valbuf, 4); write_memory (descr + 4, valbuf, 4);
return descr; return descr;
@ -1167,11 +1173,12 @@ static CORE_ADDR
frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, frv_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
struct target_ops *targ) struct target_ops *targ)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR entry_point; CORE_ADDR entry_point;
CORE_ADDR got_address; CORE_ADDR got_address;
entry_point = get_target_memory_unsigned (targ, addr, 4); entry_point = get_target_memory_unsigned (targ, addr, 4, byte_order);
got_address = get_target_memory_unsigned (targ, addr + 4, 4); got_address = get_target_memory_unsigned (targ, addr + 4, 4, byte_order);
if (got_address == frv_fdpic_find_global_pointer (entry_point)) if (got_address == frv_fdpic_find_global_pointer (entry_point))
return entry_point; return entry_point;
@ -1185,6 +1192,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int argreg; int argreg;
int argnum; int argnum;
char *val; char *val;
@ -1232,7 +1240,8 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION) if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
{ {
store_unsigned_integer (valbuf, 4, value_address (arg)); store_unsigned_integer (valbuf, 4, byte_order,
value_address (arg));
typecode = TYPE_CODE_PTR; typecode = TYPE_CODE_PTR;
len = 4; len = 4;
val = valbuf; val = valbuf;
@ -1244,11 +1253,10 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
/* The FDPIC ABI requires function descriptors to be passed instead /* The FDPIC ABI requires function descriptors to be passed instead
of entry points. */ of entry points. */
store_unsigned_integer CORE_ADDR addr = extract_unsigned_integer
(valbuf, 4, (value_contents (arg), 4, byte_order);
find_func_descr (gdbarch, addr = find_func_descr (gdbarch, addr);
extract_unsigned_integer (value_contents (arg), store_unsigned_integer (valbuf, 4, byte_order, addr);
4)));
typecode = TYPE_CODE_PTR; typecode = TYPE_CODE_PTR;
len = 4; len = 4;
val = valbuf; val = valbuf;
@ -1264,7 +1272,7 @@ frv_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (argreg < 14) if (argreg < 14)
{ {
regval = extract_unsigned_integer (val, partial_len); regval = extract_unsigned_integer (val, partial_len, byte_order);
#if 0 #if 0
printf(" Argnum %d data %x -> reg %d\n", printf(" Argnum %d data %x -> reg %d\n",
argnum, (int) regval, argreg); argnum, (int) regval, argreg);

View file

@ -347,7 +347,7 @@ struct gdbarch startup_gdbarch =
0, /* print_insn */ 0, /* print_insn */
0, /* skip_trampoline_code */ 0, /* skip_trampoline_code */
generic_skip_solib_resolver, /* skip_solib_resolver */ generic_skip_solib_resolver, /* skip_solib_resolver */
0, /* in_solib_return_trampoline */ generic_in_solib_return_trampoline, /* in_solib_return_trampoline */
generic_in_function_epilogue_p, /* in_function_epilogue_p */ generic_in_function_epilogue_p, /* in_function_epilogue_p */
0, /* elf_make_msymbol_special */ 0, /* elf_make_msymbol_special */
0, /* coff_make_msymbol_special */ 0, /* coff_make_msymbol_special */
@ -2682,7 +2682,7 @@ gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char
gdb_assert (gdbarch->in_solib_return_trampoline != NULL); gdb_assert (gdbarch->in_solib_return_trampoline != NULL);
if (gdbarch_debug >= 2) if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_return_trampoline called\n"); fprintf_unfiltered (gdb_stdlog, "gdbarch_in_solib_return_trampoline called\n");
return gdbarch->in_solib_return_trampoline (pc, name); return gdbarch->in_solib_return_trampoline (gdbarch, pc, name);
} }
void void

View file

@ -563,7 +563,7 @@ extern void set_gdbarch_skip_solib_resolver (struct gdbarch *gdbarch, gdbarch_sk
/* Some systems also have trampoline code for returning from shared libs. */ /* Some systems also have trampoline code for returning from shared libs. */
typedef int (gdbarch_in_solib_return_trampoline_ftype) (CORE_ADDR pc, char *name); typedef int (gdbarch_in_solib_return_trampoline_ftype) (struct gdbarch *gdbarch, CORE_ADDR pc, char *name);
extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name); extern int gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name);
extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline); extern void set_gdbarch_in_solib_return_trampoline (struct gdbarch *gdbarch, gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline);

View file

@ -563,7 +563,7 @@ f:CORE_ADDR:skip_trampoline_code:struct frame_info *frame, CORE_ADDR pc:frame, p
# a step-resume breakpoint to get us past the dynamic linker. # a step-resume breakpoint to get us past the dynamic linker.
m:CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc::generic_skip_solib_resolver::0 m:CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc::generic_skip_solib_resolver::0
# Some systems also have trampoline code for returning from shared libs. # Some systems also have trampoline code for returning from shared libs.
f:int:in_solib_return_trampoline:CORE_ADDR pc, char *name:pc, name::generic_in_solib_return_trampoline::0 m:int:in_solib_return_trampoline:CORE_ADDR pc, char *name:pc, name::generic_in_solib_return_trampoline::0
# A target might have problems with watchpoints as soon as the stack # A target might have problems with watchpoints as soon as the stack
# frame of the current function has been destroyed. This mostly happens # frame of the current function has been destroyed. This mostly happens

View file

@ -50,13 +50,16 @@ extern void read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len);
/* Read an integer from debugged memory, given address and number of /* Read an integer from debugged memory, given address and number of
bytes. */ bytes. */
extern LONGEST read_memory_integer (CORE_ADDR memaddr, int len); extern LONGEST read_memory_integer (CORE_ADDR memaddr,
extern int safe_read_memory_integer (CORE_ADDR memaddr, int len, LONGEST *return_value); int len, enum bfd_endian byte_order);
extern int safe_read_memory_integer (CORE_ADDR memaddr, int len,
enum bfd_endian byte_order, LONGEST *return_value);
/* Read an unsigned integer from debugged memory, given address and /* Read an unsigned integer from debugged memory, given address and
number of bytes. */ number of bytes. */
extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr, int len); extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr,
int len, enum bfd_endian byte_order);
/* Read a null-terminated string from the debuggee's memory, given address, /* Read a null-terminated string from the debuggee's memory, given address,
* a buffer into which to place the string, and the maximum available space */ * a buffer into which to place the string, and the maximum available space */
@ -77,10 +80,12 @@ extern void write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, int len);
/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */ /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
extern void write_memory_unsigned_integer (CORE_ADDR addr, int len, extern void write_memory_unsigned_integer (CORE_ADDR addr, int len,
ULONGEST value); enum bfd_endian byte_order,
ULONGEST value);
/* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */ /* Store VALUE at ADDR in the inferior as a LEN-byte unsigned integer. */
extern void write_memory_signed_integer (CORE_ADDR addr, int len, extern void write_memory_signed_integer (CORE_ADDR addr, int len,
enum bfd_endian byte_order,
LONGEST value); LONGEST value);
/* Hook for `exec_file_command' command to call. */ /* Hook for `exec_file_command' command to call. */

View file

@ -514,6 +514,7 @@ gnuv3_decode_method_ptr (struct gdbarch *gdbarch,
{ {
struct type *funcptr_type = builtin_type (gdbarch)->builtin_func_ptr; struct type *funcptr_type = builtin_type (gdbarch)->builtin_func_ptr;
struct type *offset_type = vtable_ptrdiff_type (gdbarch); struct type *offset_type = vtable_ptrdiff_type (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR ptr_value; CORE_ADDR ptr_value;
LONGEST voffset, adjustment; LONGEST voffset, adjustment;
int vbit; int vbit;
@ -525,9 +526,11 @@ gnuv3_decode_method_ptr (struct gdbarch *gdbarch,
yet know which case we have, so we extract the value under both yet know which case we have, so we extract the value under both
interpretations and choose the right one later on. */ interpretations and choose the right one later on. */
ptr_value = extract_typed_address (contents, funcptr_type); ptr_value = extract_typed_address (contents, funcptr_type);
voffset = extract_signed_integer (contents, TYPE_LENGTH (funcptr_type)); voffset = extract_signed_integer (contents,
TYPE_LENGTH (funcptr_type), byte_order);
contents += TYPE_LENGTH (funcptr_type); contents += TYPE_LENGTH (funcptr_type);
adjustment = extract_signed_integer (contents, TYPE_LENGTH (offset_type)); adjustment = extract_signed_integer (contents,
TYPE_LENGTH (offset_type), byte_order);
if (!gdbarch_vbit_in_delta (gdbarch)) if (!gdbarch_vbit_in_delta (gdbarch))
{ {
@ -632,6 +635,7 @@ gnuv3_make_method_ptr (struct type *type, gdb_byte *contents,
struct type *domain_type = check_typedef (TYPE_DOMAIN_TYPE (type)); struct type *domain_type = check_typedef (TYPE_DOMAIN_TYPE (type));
struct gdbarch *gdbarch = get_type_arch (domain_type); struct gdbarch *gdbarch = get_type_arch (domain_type);
int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr); int size = TYPE_LENGTH (builtin_type (gdbarch)->builtin_data_ptr);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* FIXME drow/2006-12-24: The adjustment of "this" is currently /* FIXME drow/2006-12-24: The adjustment of "this" is currently
always zero, since the method pointer is of the correct type. always zero, since the method pointer is of the correct type.
@ -644,13 +648,13 @@ gnuv3_make_method_ptr (struct type *type, gdb_byte *contents,
if (!gdbarch_vbit_in_delta (gdbarch)) if (!gdbarch_vbit_in_delta (gdbarch))
{ {
store_unsigned_integer (contents, size, value | is_virtual); store_unsigned_integer (contents, size, byte_order, value | is_virtual);
store_unsigned_integer (contents + size, size, 0); store_unsigned_integer (contents + size, size, byte_order, 0);
} }
else else
{ {
store_unsigned_integer (contents, size, value); store_unsigned_integer (contents, size, byte_order, value);
store_unsigned_integer (contents + size, size, is_virtual); store_unsigned_integer (contents + size, size, byte_order, is_virtual);
} }
} }

View file

@ -178,9 +178,10 @@ h8300_init_frame_cache (struct gdbarch *gdbarch,
is used, it could be a byte, word or long move to registers r3-r5. */ is used, it could be a byte, word or long move to registers r3-r5. */
static int static int
h8300_is_argument_spill (CORE_ADDR pc) h8300_is_argument_spill (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
int w = read_memory_unsigned_integer (pc, 2); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int w = read_memory_unsigned_integer (pc, 2, byte_order);
if ((IS_MOVB_RnRm (w) || IS_MOVW_RnRm (w) || IS_MOVL_RnRm (w)) if ((IS_MOVB_RnRm (w) || IS_MOVW_RnRm (w) || IS_MOVL_RnRm (w))
&& (w & 0x70) <= 0x20 /* Rs is R0, R1 or R2 */ && (w & 0x70) <= 0x20 /* Rs is R0, R1 or R2 */
@ -190,14 +191,16 @@ h8300_is_argument_spill (CORE_ADDR pc)
if (IS_MOVB_Rn16_SP (w) if (IS_MOVB_Rn16_SP (w)
&& 8 <= (w & 0xf) && (w & 0xf) <= 10) /* Rs is R0L, R1L, or R2L */ && 8 <= (w & 0xf) && (w & 0xf) <= 10) /* Rs is R0L, R1L, or R2L */
{ {
if (read_memory_integer (pc + 2, 2) < 0) /* ... and d:16 is negative. */ /* ... and d:16 is negative. */
if (read_memory_integer (pc + 2, 2, byte_order) < 0)
return 4; return 4;
} }
else if (IS_MOVB_EXT (w)) else if (IS_MOVB_EXT (w))
{ {
if (IS_MOVB_Rn24_SP (read_memory_unsigned_integer (pc + 2, 2))) if (IS_MOVB_Rn24_SP (read_memory_unsigned_integer (pc + 2,
2, byte_order)))
{ {
LONGEST disp = read_memory_integer (pc + 4, 4); LONGEST disp = read_memory_integer (pc + 4, 4, byte_order);
/* ... and d:24 is negative. */ /* ... and d:24 is negative. */
if (disp < 0 && disp > 0xffffff) if (disp < 0 && disp > 0xffffff)
@ -208,14 +211,15 @@ h8300_is_argument_spill (CORE_ADDR pc)
&& (w & 0xf) <= 2) /* Rs is R0, R1, or R2 */ && (w & 0xf) <= 2) /* Rs is R0, R1, or R2 */
{ {
/* ... and d:16 is negative. */ /* ... and d:16 is negative. */
if (read_memory_integer (pc + 2, 2) < 0) if (read_memory_integer (pc + 2, 2, byte_order) < 0)
return 4; return 4;
} }
else if (IS_MOVW_EXT (w)) else if (IS_MOVW_EXT (w))
{ {
if (IS_MOVW_Rn24_SP (read_memory_unsigned_integer (pc + 2, 2))) if (IS_MOVW_Rn24_SP (read_memory_unsigned_integer (pc + 2,
2, byte_order)))
{ {
LONGEST disp = read_memory_integer (pc + 4, 4); LONGEST disp = read_memory_integer (pc + 4, 4, byte_order);
/* ... and d:24 is negative. */ /* ... and d:24 is negative. */
if (disp < 0 && disp > 0xffffff) if (disp < 0 && disp > 0xffffff)
@ -224,22 +228,22 @@ h8300_is_argument_spill (CORE_ADDR pc)
} }
else if (IS_MOVL_PRE (w)) else if (IS_MOVL_PRE (w))
{ {
int w2 = read_memory_integer (pc + 2, 2); int w2 = read_memory_integer (pc + 2, 2, byte_order);
if (IS_MOVL_Rn16_SP (w2) if (IS_MOVL_Rn16_SP (w2)
&& (w2 & 0xf) <= 2) /* Rs is ER0, ER1, or ER2 */ && (w2 & 0xf) <= 2) /* Rs is ER0, ER1, or ER2 */
{ {
/* ... and d:16 is negative. */ /* ... and d:16 is negative. */
if (read_memory_integer (pc + 4, 2) < 0) if (read_memory_integer (pc + 4, 2, byte_order) < 0)
return 6; return 6;
} }
else if (IS_MOVL_EXT (w2)) else if (IS_MOVL_EXT (w2))
{ {
int w3 = read_memory_integer (pc + 4, 2); int w3 = read_memory_integer (pc + 4, 2, byte_order);
if (IS_MOVL_Rn24_SP (read_memory_integer (pc + 4, 2))) if (IS_MOVL_Rn24_SP (read_memory_integer (pc + 4, 2, byte_order)))
{ {
LONGEST disp = read_memory_integer (pc + 6, 4); LONGEST disp = read_memory_integer (pc + 6, 4, byte_order);
/* ... and d:24 is negative. */ /* ... and d:24 is negative. */
if (disp < 0 && disp > 0xffffff) if (disp < 0 && disp > 0xffffff)
@ -287,9 +291,11 @@ h8300_is_argument_spill (CORE_ADDR pc)
*/ */
static CORE_ADDR static CORE_ADDR
h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, h8300_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR pc, CORE_ADDR current_pc,
struct h8300_frame_cache *cache) struct h8300_frame_cache *cache)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int op; unsigned int op;
int regno, i, spill_size; int regno, i, spill_size;
@ -298,7 +304,7 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
if (pc >= current_pc) if (pc >= current_pc)
return current_pc; return current_pc;
op = read_memory_unsigned_integer (pc, 4); op = read_memory_unsigned_integer (pc, 4, byte_order);
if (IS_PUSHFP_MOVESPFP (op)) if (IS_PUSHFP_MOVESPFP (op))
{ {
@ -312,7 +318,7 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
pc += 4; pc += 4;
if (pc >= current_pc) if (pc >= current_pc)
return current_pc; return current_pc;
op = read_memory_unsigned_integer (pc, 2); op = read_memory_unsigned_integer (pc, 2, byte_order);
if (IS_MOV_SP_FP (op)) if (IS_MOV_SP_FP (op))
{ {
cache->uses_fp = 1; cache->uses_fp = 1;
@ -322,7 +328,7 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
while (pc < current_pc) while (pc < current_pc)
{ {
op = read_memory_unsigned_integer (pc, 2); op = read_memory_unsigned_integer (pc, 2, byte_order);
if (IS_SUB2_SP (op)) if (IS_SUB2_SP (op))
{ {
cache->sp_offset += 2; cache->sp_offset += 2;
@ -335,12 +341,12 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
} }
else if (IS_ADD_IMM_SP (op)) else if (IS_ADD_IMM_SP (op))
{ {
cache->sp_offset += -read_memory_integer (pc + 2, 2); cache->sp_offset += -read_memory_integer (pc + 2, 2, byte_order);
pc += 4; pc += 4;
} }
else if (IS_SUB_IMM_SP (op)) else if (IS_SUB_IMM_SP (op))
{ {
cache->sp_offset += read_memory_integer (pc + 2, 2); cache->sp_offset += read_memory_integer (pc + 2, 2, byte_order);
pc += 4; pc += 4;
} }
else if (IS_SUBL4_SP (op)) else if (IS_SUBL4_SP (op))
@ -350,9 +356,9 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
} }
else if (IS_MOV_IMM_Rn (op)) else if (IS_MOV_IMM_Rn (op))
{ {
int offset = read_memory_integer (pc + 2, 2); int offset = read_memory_integer (pc + 2, 2, byte_order);
regno = op & 0x000f; regno = op & 0x000f;
op = read_memory_unsigned_integer (pc + 4, 2); op = read_memory_unsigned_integer (pc + 4, 2, byte_order);
if (IS_ADD_RnSP (op) && (op & 0x00f0) == regno) if (IS_ADD_RnSP (op) && (op & 0x00f0) == regno)
{ {
cache->sp_offset -= offset; cache->sp_offset -= offset;
@ -375,7 +381,7 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
} }
else if (op == 0x0100) else if (op == 0x0100)
{ {
op = read_memory_unsigned_integer (pc + 2, 2); op = read_memory_unsigned_integer (pc + 2, 2, byte_order);
if (IS_PUSH (op)) if (IS_PUSH (op))
{ {
regno = op & 0x000f; regno = op & 0x000f;
@ -389,7 +395,7 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
else if ((op & 0xffcf) == 0x0100) else if ((op & 0xffcf) == 0x0100)
{ {
int op1; int op1;
op1 = read_memory_unsigned_integer (pc + 2, 2); op1 = read_memory_unsigned_integer (pc + 2, 2, byte_order);
if (IS_PUSH (op1)) if (IS_PUSH (op1))
{ {
/* Since the prefix is 0x01x0, this is not a simple pushm but a /* Since the prefix is 0x01x0, this is not a simple pushm but a
@ -413,7 +419,7 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
/* Check for spilling an argument register to the stack frame. /* Check for spilling an argument register to the stack frame.
This could also be an initializing store from non-prologue code, This could also be an initializing store from non-prologue code,
but I don't think there's any harm in skipping that. */ but I don't think there's any harm in skipping that. */
while ((spill_size = h8300_is_argument_spill (pc)) > 0 while ((spill_size = h8300_is_argument_spill (gdbarch, pc)) > 0
&& pc + spill_size <= current_pc) && pc + spill_size <= current_pc)
pc += spill_size; pc += spill_size;
@ -451,7 +457,7 @@ h8300_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->pc = get_frame_func (this_frame); cache->pc = get_frame_func (this_frame);
current_pc = get_frame_pc (this_frame); current_pc = get_frame_pc (this_frame);
if (cache->pc != 0) if (cache->pc != 0)
h8300_analyze_prologue (cache->pc, current_pc, cache); h8300_analyze_prologue (gdbarch, cache->pc, current_pc, cache);
if (!cache->uses_fp) if (!cache->uses_fp)
{ {
@ -558,7 +564,7 @@ h8300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* No useable line symbol. Use prologue parsing method. */ /* No useable line symbol. Use prologue parsing method. */
h8300_init_frame_cache (gdbarch, &cache); h8300_init_frame_cache (gdbarch, &cache);
return h8300_analyze_prologue (func_addr, func_end, &cache); return h8300_analyze_prologue (gdbarch, func_addr, func_end, &cache);
} }
/* No function symbol -- just return the PC. */ /* No function symbol -- just return the PC. */
@ -635,6 +641,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int stack_alloc = 0, stack_offset = 0; int stack_alloc = 0, stack_offset = 0;
int wordsize = BINWORD (gdbarch); int wordsize = BINWORD (gdbarch);
int reg = E_ARG0_REGNUM; int reg = E_ARG0_REGNUM;
@ -698,8 +705,9 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (offset = 0; offset < padded_len; offset += wordsize) for (offset = 0; offset < padded_len; offset += wordsize)
{ {
ULONGEST word = extract_unsigned_integer (padded + offset, ULONGEST word
wordsize); = extract_unsigned_integer (padded + offset,
wordsize, byte_order);
regcache_cooked_write_unsigned (regcache, reg++, word); regcache_cooked_write_unsigned (regcache, reg++, word);
} }
} }
@ -718,7 +726,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Store return address. */ /* Store return address. */
sp -= wordsize; sp -= wordsize;
write_memory_unsigned_integer (sp, wordsize, bp_addr); write_memory_unsigned_integer (sp, wordsize, byte_order, bp_addr);
/* Update stack pointer. */ /* Update stack pointer. */
regcache_cooked_write_unsigned (regcache, E_SP_REGNUM, sp); regcache_cooked_write_unsigned (regcache, E_SP_REGNUM, sp);
@ -736,6 +744,8 @@ static void
h8300_extract_return_value (struct type *type, struct regcache *regcache, h8300_extract_return_value (struct type *type, struct regcache *regcache,
void *valbuf) void *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
ULONGEST c, addr; ULONGEST c, addr;
@ -744,20 +754,20 @@ h8300_extract_return_value (struct type *type, struct regcache *regcache,
case 1: case 1:
case 2: case 2:
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, len, c); store_unsigned_integer (valbuf, len, byte_order, c);
break; break;
case 4: /* Needs two registers on plain H8/300 */ case 4: /* Needs two registers on plain H8/300 */
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, 2, c); store_unsigned_integer (valbuf, 2, byte_order, c);
regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c); regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c);
store_unsigned_integer ((void *) ((char *) valbuf + 2), 2, c); store_unsigned_integer ((void *)((char *) valbuf + 2), 2, byte_order, c);
break; break;
case 8: /* long long is now 8 bytes. */ case 8: /* long long is now 8 bytes. */
if (TYPE_CODE (type) == TYPE_CODE_INT) if (TYPE_CODE (type) == TYPE_CODE_INT)
{ {
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr); regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr);
c = read_memory_unsigned_integer ((CORE_ADDR) addr, len); c = read_memory_unsigned_integer ((CORE_ADDR) addr, len, byte_order);
store_unsigned_integer (valbuf, len, c); store_unsigned_integer (valbuf, len, byte_order, c);
} }
else else
{ {
@ -771,6 +781,8 @@ static void
h8300h_extract_return_value (struct type *type, struct regcache *regcache, h8300h_extract_return_value (struct type *type, struct regcache *regcache,
void *valbuf) void *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
ULONGEST c, addr; ULONGEST c, addr;
@ -780,15 +792,16 @@ h8300h_extract_return_value (struct type *type, struct regcache *regcache,
case 2: case 2:
case 4: case 4:
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, len, c); store_unsigned_integer (valbuf, len, byte_order, c);
break; break;
case 8: /* long long is now 8 bytes. */ case 8: /* long long is now 8 bytes. */
if (TYPE_CODE (type) == TYPE_CODE_INT) if (TYPE_CODE (type) == TYPE_CODE_INT)
{ {
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, 4, c); store_unsigned_integer (valbuf, 4, byte_order, c);
regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c); regcache_cooked_read_unsigned (regcache, E_RET1_REGNUM, &c);
store_unsigned_integer ((void *) ((char *) valbuf + 4), 4, c); store_unsigned_integer ((void *) ((char *) valbuf + 4), 4,
byte_order, c);
} }
else else
{ {
@ -835,6 +848,8 @@ static void
h8300_store_return_value (struct type *type, struct regcache *regcache, h8300_store_return_value (struct type *type, struct regcache *regcache,
const void *valbuf) const void *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
ULONGEST val; ULONGEST val;
@ -842,11 +857,11 @@ h8300_store_return_value (struct type *type, struct regcache *regcache,
{ {
case 1: case 1:
case 2: /* short... */ case 2: /* short... */
val = extract_unsigned_integer (valbuf, len); val = extract_unsigned_integer (valbuf, len, byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val); regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break; break;
case 4: /* long, float */ case 4: /* long, float */
val = extract_unsigned_integer (valbuf, len); val = extract_unsigned_integer (valbuf, len, byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
(val >> 16) & 0xffff); (val >> 16) & 0xffff);
regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff); regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff);
@ -862,6 +877,8 @@ static void
h8300h_store_return_value (struct type *type, struct regcache *regcache, h8300h_store_return_value (struct type *type, struct regcache *regcache,
const void *valbuf) const void *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
ULONGEST val; ULONGEST val;
@ -870,11 +887,11 @@ h8300h_store_return_value (struct type *type, struct regcache *regcache,
case 1: case 1:
case 2: case 2:
case 4: /* long, float */ case 4: /* long, float */
val = extract_unsigned_integer (valbuf, len); val = extract_unsigned_integer (valbuf, len, byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val); regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val);
break; break;
case 8: case 8:
val = extract_unsigned_integer (valbuf, len); val = extract_unsigned_integer (valbuf, len, byte_order);
regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM,
(val >> 32) & 0xffffffff); (val >> 32) & 0xffffffff);
regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM,

View file

@ -88,6 +88,7 @@ static void
hppa_hpux_fetch_register (struct regcache *regcache, int regnum) hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR addr; CORE_ADDR addr;
size_t size; size_t size;
PTRACE_TYPE_RET *buf; PTRACE_TYPE_RET *buf;
@ -135,8 +136,9 @@ hppa_hpux_fetch_register (struct regcache *regcache, int regnum)
`struct save_state', even for 64-bit code. */ `struct save_state', even for 64-bit code. */
if (regnum == HPPA_FLAGS_REGNUM && size == 8) if (regnum == HPPA_FLAGS_REGNUM && size == 8)
{ {
ULONGEST flags = extract_unsigned_integer ((gdb_byte *)buf, 4); ULONGEST flags;
store_unsigned_integer ((gdb_byte *)buf, 8, flags); flags = extract_unsigned_integer ((gdb_byte *)buf, 4, byte_order);
store_unsigned_integer ((gdb_byte *)buf, 8, byte_order, flags);
} }
regcache_raw_supply (regcache, regnum, buf); regcache_raw_supply (regcache, regnum, buf);
@ -161,6 +163,7 @@ static void
hppa_hpux_store_register (struct regcache *regcache, int regnum) hppa_hpux_store_register (struct regcache *regcache, int regnum)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR addr; CORE_ADDR addr;
size_t size; size_t size;
PTRACE_TYPE_RET *buf; PTRACE_TYPE_RET *buf;
@ -181,8 +184,9 @@ hppa_hpux_store_register (struct regcache *regcache, int regnum)
`struct save_state', even for 64-bit code. */ `struct save_state', even for 64-bit code. */
if (regnum == HPPA_FLAGS_REGNUM && size == 8) if (regnum == HPPA_FLAGS_REGNUM && size == 8)
{ {
ULONGEST flags = extract_unsigned_integer ((gdb_byte *)buf, 8); ULONGEST flags;
store_unsigned_integer ((gdb_byte *)buf, 4, flags); flags = extract_unsigned_integer ((gdb_byte *)buf, 8, byte_order);
store_unsigned_integer ((gdb_byte *)buf, 4, byte_order, flags);
size = 4; size = 4;
} }

View file

@ -86,8 +86,10 @@ in_opd_section (CORE_ADDR pc)
just shared library trampolines (import, export). */ just shared library trampolines (import, export). */
static int static int
hppa32_hpux_in_solib_call_trampoline (CORE_ADDR pc, char *name) hppa32_hpux_in_solib_call_trampoline (struct gdbarch *gdbarch,
CORE_ADDR pc, char *name)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct minimal_symbol *minsym; struct minimal_symbol *minsym;
struct unwind_table_entry *u; struct unwind_table_entry *u;
@ -133,7 +135,7 @@ hppa32_hpux_in_solib_call_trampoline (CORE_ADDR pc, char *name)
{ {
unsigned long insn; unsigned long insn;
insn = read_memory_integer (addr, 4); insn = read_memory_integer (addr, 4, byte_order);
/* Does it look like a bl? If so then it's the call path, if /* Does it look like a bl? If so then it's the call path, if
we find a bv or be first, then we're on the return path. */ we find a bv or be first, then we're on the return path. */
@ -154,8 +156,11 @@ hppa32_hpux_in_solib_call_trampoline (CORE_ADDR pc, char *name)
} }
static int static int
hppa64_hpux_in_solib_call_trampoline (CORE_ADDR pc, char *name) hppa64_hpux_in_solib_call_trampoline (struct gdbarch *gdbarch,
CORE_ADDR pc, char *name)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* PA64 has a completely different stub/trampoline scheme. Is it /* PA64 has a completely different stub/trampoline scheme. Is it
better? Maybe. It's certainly harder to determine with any better? Maybe. It's certainly harder to determine with any
certainty that we are in a stub because we can not refer to the certainty that we are in a stub because we can not refer to the
@ -188,7 +193,7 @@ hppa64_hpux_in_solib_call_trampoline (CORE_ADDR pc, char *name)
/* We might be in a stub. Peek at the instructions. Stubs are 3 /* We might be in a stub. Peek at the instructions. Stubs are 3
instructions long. */ instructions long. */
insn = read_memory_integer (pc, 4); insn = read_memory_integer (pc, 4, byte_order);
/* Find out where we think we are within the stub. */ /* Find out where we think we are within the stub. */
if ((insn & 0xffffc00e) == 0x53610000) if ((insn & 0xffffc00e) == 0x53610000)
@ -201,17 +206,17 @@ hppa64_hpux_in_solib_call_trampoline (CORE_ADDR pc, char *name)
return 0; return 0;
/* Now verify each insn in the range looks like a stub instruction. */ /* Now verify each insn in the range looks like a stub instruction. */
insn = read_memory_integer (addr, 4); insn = read_memory_integer (addr, 4, byte_order);
if ((insn & 0xffffc00e) != 0x53610000) if ((insn & 0xffffc00e) != 0x53610000)
return 0; return 0;
/* Now verify each insn in the range looks like a stub instruction. */ /* Now verify each insn in the range looks like a stub instruction. */
insn = read_memory_integer (addr + 4, 4); insn = read_memory_integer (addr + 4, 4, byte_order);
if ((insn & 0xffffffff) != 0xe820d000) if ((insn & 0xffffffff) != 0xe820d000)
return 0; return 0;
/* Now verify each insn in the range looks like a stub instruction. */ /* Now verify each insn in the range looks like a stub instruction. */
insn = read_memory_integer (addr + 8, 4); insn = read_memory_integer (addr + 8, 4, byte_order);
if ((insn & 0xffffc00e) != 0x537b0000) if ((insn & 0xffffc00e) != 0x537b0000)
return 0; return 0;
@ -225,8 +230,10 @@ hppa64_hpux_in_solib_call_trampoline (CORE_ADDR pc, char *name)
just shared library trampolines (import, export). */ just shared library trampolines (import, export). */
static int static int
hppa_hpux_in_solib_return_trampoline (CORE_ADDR pc, char *name) hppa_hpux_in_solib_return_trampoline (struct gdbarch *gdbarch,
CORE_ADDR pc, char *name)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct unwind_table_entry *u; struct unwind_table_entry *u;
/* Get the unwind descriptor corresponding to PC, return zero /* Get the unwind descriptor corresponding to PC, return zero
@ -259,7 +266,7 @@ hppa_hpux_in_solib_return_trampoline (CORE_ADDR pc, char *name)
{ {
unsigned long insn; unsigned long insn;
insn = read_memory_integer (addr, 4); insn = read_memory_integer (addr, 4, byte_order);
/* Does it look like a bl? If so then it's the call path, if /* Does it look like a bl? If so then it's the call path, if
we find a bv or be first, then we're on the return path. */ we find a bv or be first, then we're on the return path. */
@ -301,6 +308,8 @@ static CORE_ADDR
hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
long orig_pc = pc; long orig_pc = pc;
long prev_inst, curr_inst, loc; long prev_inst, curr_inst, loc;
struct minimal_symbol *msym; struct minimal_symbol *msym;
@ -316,14 +325,12 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
the PLT entry for this function, not the address of the function the PLT entry for this function, not the address of the function
itself. Bit 31 has meaning too, but only for MPE. */ itself. Bit 31 has meaning too, but only for MPE. */
if (pc & 0x2) if (pc & 0x2)
pc = (CORE_ADDR) read_memory_integer pc = (CORE_ADDR) read_memory_integer (pc & ~0x3, word_size, byte_order);
(pc & ~0x3, gdbarch_ptr_bit (gdbarch) / 8);
} }
if (pc == hppa_symbol_address("$$dyncall_external")) if (pc == hppa_symbol_address("$$dyncall_external"))
{ {
pc = (CORE_ADDR) get_frame_register_unsigned (frame, 22); pc = (CORE_ADDR) get_frame_register_unsigned (frame, 22);
pc = (CORE_ADDR) read_memory_integer pc = (CORE_ADDR) read_memory_integer (pc & ~0x3, word_size, byte_order);
(pc & ~0x3, gdbarch_ptr_bit (gdbarch) / 8);
} }
else if (pc == hppa_symbol_address("_sr4export")) else if (pc == hppa_symbol_address("_sr4export"))
pc = (CORE_ADDR) get_frame_register_unsigned (frame, 22); pc = (CORE_ADDR) get_frame_register_unsigned (frame, 22);
@ -420,7 +427,7 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
} }
prev_inst = curr_inst; prev_inst = curr_inst;
curr_inst = read_memory_integer (loc, 4); curr_inst = read_memory_integer (loc, 4, byte_order);
/* Does it look like a branch external using %r1? Then it's the /* Does it look like a branch external using %r1? Then it's the
branch from the stub to the actual function. */ branch from the stub to the actual function. */
@ -504,7 +511,7 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{ {
CORE_ADDR sp; CORE_ADDR sp;
sp = get_frame_register_unsigned (frame, HPPA_SP_REGNUM); sp = get_frame_register_unsigned (frame, HPPA_SP_REGNUM);
return read_memory_integer (sp - 8, 4) & ~0x3; return read_memory_integer (sp - 8, 4, byte_order) & ~0x3;
} }
else else
{ {
@ -520,7 +527,7 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{ {
return (read_memory_integer return (read_memory_integer
(get_frame_register_unsigned (frame, HPPA_SP_REGNUM) - 24, (get_frame_register_unsigned (frame, HPPA_SP_REGNUM) - 24,
gdbarch_ptr_bit (gdbarch) / 8)) & ~0x3; word_size, byte_order)) & ~0x3;
} }
/* What about be,n 0(sr0,%rp)? It's just another way we return to /* What about be,n 0(sr0,%rp)? It's just another way we return to
@ -533,7 +540,7 @@ hppa_hpux_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
mtsp %r1,%sr0 if we want to do sanity checking. */ mtsp %r1,%sr0 if we want to do sanity checking. */
return (read_memory_integer return (read_memory_integer
(get_frame_register_unsigned (frame, HPPA_SP_REGNUM) - 24, (get_frame_register_unsigned (frame, HPPA_SP_REGNUM) - 24,
gdbarch_ptr_bit (gdbarch) / 8)) & ~0x3; word_size, byte_order)) & ~0x3;
} }
/* Haven't found the branch yet, but we're still in the stub. /* Haven't found the branch yet, but we're still in the stub.
@ -618,6 +625,7 @@ hppa_hpux_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct hppa_hpux_sigtramp_unwind_cache *info; struct hppa_hpux_sigtramp_unwind_cache *info;
unsigned int flag; unsigned int flag;
CORE_ADDR sp, scptr, off; CORE_ADDR sp, scptr, off;
@ -642,7 +650,8 @@ hppa_hpux_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
/* See /usr/include/machine/save_state.h for the structure of the save_state_t /* See /usr/include/machine/save_state.h for the structure of the save_state_t
structure. */ structure. */
flag = read_memory_unsigned_integer(scptr + HPPA_HPUX_SS_FLAGS_OFFSET, 4); flag = read_memory_unsigned_integer (scptr + HPPA_HPUX_SS_FLAGS_OFFSET,
4, byte_order);
if (!(flag & HPPA_HPUX_SS_WIDEREGS)) if (!(flag & HPPA_HPUX_SS_WIDEREGS))
{ {
@ -707,6 +716,8 @@ hppa_hpux_sigtramp_unwind_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame, struct frame_info *this_frame,
void **this_cache) void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct unwind_table_entry *u; struct unwind_table_entry *u;
CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR pc = get_frame_pc (this_frame);
@ -723,7 +734,7 @@ hppa_hpux_sigtramp_unwind_sniffer (const struct frame_unwind *self,
buf, sizeof buf)) buf, sizeof buf))
return 0; return 0;
insn = extract_unsigned_integer (buf, sizeof buf); insn = extract_unsigned_integer (buf, sizeof buf, byte_order);
if ((insn & 0xffe0e000) == 0xe8400000) if ((insn & 0xffe0e000) == 0xe8400000)
u = find_unwind_entry(u->region_start + hppa_extract_17 (insn) + 8); u = find_unwind_entry(u->region_start + hppa_extract_17 (insn) + 8);
} }
@ -746,6 +757,7 @@ static CORE_ADDR
hppa32_hpux_find_global_pointer (struct gdbarch *gdbarch, hppa32_hpux_find_global_pointer (struct gdbarch *gdbarch,
struct value *function) struct value *function)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR faddr; CORE_ADDR faddr;
faddr = value_as_address (function); faddr = value_as_address (function);
@ -760,7 +772,7 @@ hppa32_hpux_find_global_pointer (struct gdbarch *gdbarch,
status = target_read_memory (faddr + 4, buf, sizeof (buf)); status = target_read_memory (faddr + 4, buf, sizeof (buf));
if (status == 0) if (status == 0)
return extract_unsigned_integer (buf, sizeof (buf)); return extract_unsigned_integer (buf, sizeof (buf), byte_order);
} }
return gdbarch_tdep (gdbarch)->solib_get_got_by_pc (faddr); return gdbarch_tdep (gdbarch)->solib_get_got_by_pc (faddr);
@ -770,6 +782,7 @@ static CORE_ADDR
hppa64_hpux_find_global_pointer (struct gdbarch *gdbarch, hppa64_hpux_find_global_pointer (struct gdbarch *gdbarch,
struct value *function) struct value *function)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR faddr; CORE_ADDR faddr;
char buf[32]; char buf[32];
@ -778,7 +791,7 @@ hppa64_hpux_find_global_pointer (struct gdbarch *gdbarch,
if (in_opd_section (faddr)) if (in_opd_section (faddr))
{ {
target_read_memory (faddr, buf, sizeof (buf)); target_read_memory (faddr, buf, sizeof (buf));
return extract_unsigned_integer (&buf[24], 8); return extract_unsigned_integer (&buf[24], 8, byte_order);
} }
else else
{ {
@ -793,9 +806,11 @@ static unsigned int ldsid_pattern[] = {
}; };
static CORE_ADDR static CORE_ADDR
hppa_hpux_search_pattern (CORE_ADDR start, CORE_ADDR end, hppa_hpux_search_pattern (struct gdbarch *gdbarch,
CORE_ADDR start, CORE_ADDR end,
unsigned int *patterns, int count) unsigned int *patterns, int count)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int num_insns = (end - start + HPPA_INSN_SIZE) / HPPA_INSN_SIZE; int num_insns = (end - start + HPPA_INSN_SIZE) / HPPA_INSN_SIZE;
unsigned int *insns; unsigned int *insns;
gdb_byte *buf; gdb_byte *buf;
@ -806,7 +821,7 @@ hppa_hpux_search_pattern (CORE_ADDR start, CORE_ADDR end,
read_memory (start, buf, num_insns * HPPA_INSN_SIZE); read_memory (start, buf, num_insns * HPPA_INSN_SIZE);
for (i = 0; i < num_insns; i++, buf += HPPA_INSN_SIZE) for (i = 0; i < num_insns; i++, buf += HPPA_INSN_SIZE)
insns[i] = extract_unsigned_integer (buf, HPPA_INSN_SIZE); insns[i] = extract_unsigned_integer (buf, HPPA_INSN_SIZE, byte_order);
for (offset = 0; offset <= num_insns - count; offset++) for (offset = 0; offset <= num_insns - count; offset++)
{ {
@ -829,6 +844,7 @@ static CORE_ADDR
hppa32_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc, hppa32_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc,
int *argreg) int *argreg)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct objfile *obj; struct objfile *obj;
struct obj_section *sec; struct obj_section *sec;
struct hppa_objfile_private *priv; struct hppa_objfile_private *priv;
@ -861,7 +877,8 @@ hppa32_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc,
u = find_unwind_entry (rp); u = find_unwind_entry (rp);
if (u && u->stub_unwind.stub_type == EXPORT) if (u && u->stub_unwind.stub_type == EXPORT)
{ {
addr = hppa_hpux_search_pattern (u->region_start, u->region_end, addr = hppa_hpux_search_pattern (gdbarch,
u->region_start, u->region_end,
ldsid_pattern, ldsid_pattern,
ARRAY_SIZE (ldsid_pattern)); ARRAY_SIZE (ldsid_pattern));
if (addr) if (addr)
@ -879,7 +896,8 @@ hppa32_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc,
u = &priv->unwind_info->table[i]; u = &priv->unwind_info->table[i];
if (u->stub_unwind.stub_type == EXPORT) if (u->stub_unwind.stub_type == EXPORT)
{ {
addr = hppa_hpux_search_pattern (u->region_start, u->region_end, addr = hppa_hpux_search_pattern (gdbarch,
u->region_start, u->region_end,
ldsid_pattern, ldsid_pattern,
ARRAY_SIZE (ldsid_pattern)); ARRAY_SIZE (ldsid_pattern));
if (addr) if (addr)
@ -902,7 +920,7 @@ hppa32_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc,
find_pc_partial_function (addr, NULL, &start, &end); find_pc_partial_function (addr, NULL, &start, &end);
if (start != 0 && end != 0) if (start != 0 && end != 0)
{ {
addr = hppa_hpux_search_pattern (start, end, ldsid_pattern, addr = hppa_hpux_search_pattern (gdbarch, start, end, ldsid_pattern,
ARRAY_SIZE (ldsid_pattern)); ARRAY_SIZE (ldsid_pattern));
if (addr) if (addr)
goto found_pattern; goto found_pattern;
@ -914,7 +932,7 @@ hppa32_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc,
found_pattern: found_pattern:
target_read_memory (addr, buf, sizeof (buf)); target_read_memory (addr, buf, sizeof (buf));
insn = extract_unsigned_integer (buf, sizeof (buf)); insn = extract_unsigned_integer (buf, sizeof (buf), byte_order);
priv->dummy_call_sequence_addr = addr; priv->dummy_call_sequence_addr = addr;
priv->dummy_call_sequence_reg = (insn >> 21) & 0x1f; priv->dummy_call_sequence_reg = (insn >> 21) & 0x1f;
@ -926,6 +944,7 @@ static CORE_ADDR
hppa64_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc, hppa64_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc,
int *argreg) int *argreg)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct objfile *obj; struct objfile *obj;
struct obj_section *sec; struct obj_section *sec;
struct hppa_objfile_private *priv; struct hppa_objfile_private *priv;
@ -973,7 +992,8 @@ hppa64_hpux_search_dummy_call_sequence (struct gdbarch *gdbarch, CORE_ADDR pc,
{ {
unsigned int insn; unsigned int insn;
insn = extract_unsigned_integer (buf + offset, HPPA_INSN_SIZE); insn = extract_unsigned_integer (buf + offset,
HPPA_INSN_SIZE, byte_order);
if (insn == 0xe840d002) /* bve,n (rp) */ if (insn == 0xe840d002) /* bve,n (rp) */
{ {
addr = (end - sizeof (buf)) + offset; addr = (end - sizeof (buf)) + offset;
@ -1324,18 +1344,20 @@ hppa_hpux_supply_save_state (const struct regset *regset,
struct regcache *regcache, struct regcache *regcache,
int regnum, const void *regs, size_t len) int regnum, const void *regs, size_t len)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const char *proc_info = regs; const char *proc_info = regs;
const char *save_state = proc_info + 8; const char *save_state = proc_info + 8;
ULONGEST flags; ULONGEST flags;
flags = extract_unsigned_integer (save_state + HPPA_HPUX_SS_FLAGS_OFFSET, 4); flags = extract_unsigned_integer (save_state + HPPA_HPUX_SS_FLAGS_OFFSET,
4, byte_order);
if (regnum == -1 || regnum == HPPA_FLAGS_REGNUM) if (regnum == -1 || regnum == HPPA_FLAGS_REGNUM)
{ {
struct gdbarch *arch = get_regcache_arch (regcache); size_t size = register_size (gdbarch, HPPA_FLAGS_REGNUM);
size_t size = register_size (arch, HPPA_FLAGS_REGNUM);
char buf[8]; char buf[8];
store_unsigned_integer (buf, size, flags); store_unsigned_integer (buf, size, byte_order, flags);
regcache_raw_supply (regcache, HPPA_FLAGS_REGNUM, buf); regcache_raw_supply (regcache, HPPA_FLAGS_REGNUM, buf);
} }
@ -1431,6 +1453,8 @@ hppa_hpux_unwind_adjust_stub (struct frame_info *this_frame, CORE_ADDR base,
struct trad_frame_saved_reg *saved_regs) struct trad_frame_saved_reg *saved_regs)
{ {
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);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
struct value *pcoq_head_val; struct value *pcoq_head_val;
ULONGEST pcoq_head; ULONGEST pcoq_head;
CORE_ADDR stubpc; CORE_ADDR stubpc;
@ -1440,19 +1464,19 @@ hppa_hpux_unwind_adjust_stub (struct frame_info *this_frame, CORE_ADDR base,
HPPA_PCOQ_HEAD_REGNUM); HPPA_PCOQ_HEAD_REGNUM);
pcoq_head = pcoq_head =
extract_unsigned_integer (value_contents_all (pcoq_head_val), extract_unsigned_integer (value_contents_all (pcoq_head_val),
register_size (gdbarch, HPPA_PCOQ_HEAD_REGNUM)); register_size (gdbarch, HPPA_PCOQ_HEAD_REGNUM),
byte_order);
u = find_unwind_entry (pcoq_head); u = find_unwind_entry (pcoq_head);
if (u && u->stub_unwind.stub_type == EXPORT) if (u && u->stub_unwind.stub_type == EXPORT)
{ {
stubpc = read_memory_integer (base - 24, gdbarch_ptr_bit (gdbarch) / 8); stubpc = read_memory_integer (base - 24, word_size, byte_order);
trad_frame_set_value (saved_regs, HPPA_PCOQ_HEAD_REGNUM, stubpc); trad_frame_set_value (saved_regs, HPPA_PCOQ_HEAD_REGNUM, stubpc);
} }
else if (hppa_symbol_address ("__gcc_plt_call") else if (hppa_symbol_address ("__gcc_plt_call")
== get_pc_function_start (pcoq_head)) == get_pc_function_start (pcoq_head))
{ {
stubpc = read_memory_integer stubpc = read_memory_integer (base - 8, word_size, byte_order);
(base - 8, gdbarch_ptr_bit (gdbarch) / 8);
trad_frame_set_value (saved_regs, HPPA_PCOQ_HEAD_REGNUM, stubpc); trad_frame_set_value (saved_regs, HPPA_PCOQ_HEAD_REGNUM, stubpc);
} }
} }

View file

@ -87,10 +87,11 @@ static struct insn_pattern hppa_sigtramp[] = {
When the match is successful, fill INSN[i] with what PATTERN[i] When the match is successful, fill INSN[i] with what PATTERN[i]
matched. */ matched. */
static int static int
insns_match_pattern (CORE_ADDR pc, insns_match_pattern (struct gdbarch *gdbarch, CORE_ADDR pc,
struct insn_pattern *pattern, struct insn_pattern *pattern,
unsigned int *insn) unsigned int *insn)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i; int i;
CORE_ADDR npc = pc; CORE_ADDR npc = pc;
@ -99,7 +100,7 @@ insns_match_pattern (CORE_ADDR pc,
char buf[4]; char buf[4];
target_read_memory (npc, buf, 4); target_read_memory (npc, buf, 4);
insn[i] = extract_unsigned_integer (buf, 4); insn[i] = extract_unsigned_integer (buf, 4, byte_order);
if ((insn[i] & pattern[i].mask) == pattern[i].data) if ((insn[i] & pattern[i].mask) == pattern[i].data)
npc += 4; npc += 4;
else else
@ -130,7 +131,7 @@ insns_match_pattern (CORE_ADDR pc,
Note that with a 2.4 64-bit kernel, the signal context is not properly Note that with a 2.4 64-bit kernel, the signal context is not properly
passed back to userspace so the unwind will not work correctly. */ passed back to userspace so the unwind will not work correctly. */
static CORE_ADDR static CORE_ADDR
hppa_linux_sigtramp_find_sigcontext (CORE_ADDR pc) hppa_linux_sigtramp_find_sigcontext (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
unsigned int dummy[HPPA_MAX_INSN_PATTERN_LEN]; unsigned int dummy[HPPA_MAX_INSN_PATTERN_LEN];
int offs = 0; int offs = 0;
@ -154,7 +155,8 @@ hppa_linux_sigtramp_find_sigcontext (CORE_ADDR pc)
for (try = 0; try < ARRAY_SIZE (pcoffs); try++) for (try = 0; try < ARRAY_SIZE (pcoffs); try++)
{ {
if (insns_match_pattern (sp + pcoffs[try], hppa_sigtramp, dummy)) if (insns_match_pattern (gdbarch, sp + pcoffs[try],
hppa_sigtramp, dummy))
{ {
offs = sfoffs[try]; offs = sfoffs[try];
break; break;
@ -163,7 +165,7 @@ hppa_linux_sigtramp_find_sigcontext (CORE_ADDR pc)
if (offs == 0) if (offs == 0)
{ {
if (insns_match_pattern (pc, hppa_sigtramp, dummy)) if (insns_match_pattern (gdbarch, pc, hppa_sigtramp, dummy))
{ {
/* sigaltstack case: we have no way of knowing which offset to /* sigaltstack case: we have no way of knowing which offset to
use in this case; default to new kernel handling. If this is use in this case; default to new kernel handling. If this is
@ -209,7 +211,7 @@ hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
info->saved_regs = trad_frame_alloc_saved_regs (this_frame); info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
pc = get_frame_pc (this_frame); pc = get_frame_pc (this_frame);
scptr = hppa_linux_sigtramp_find_sigcontext (pc); scptr = hppa_linux_sigtramp_find_sigcontext (gdbarch, pc);
/* structure of struct sigcontext: /* structure of struct sigcontext:
@ -299,9 +301,10 @@ hppa_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame, struct frame_info *this_frame,
void **this_prologue_cache) void **this_prologue_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR pc = get_frame_pc (this_frame);
if (hppa_linux_sigtramp_find_sigcontext (pc)) if (hppa_linux_sigtramp_find_sigcontext (gdbarch, pc))
return 1; return 1;
return 0; return 0;
@ -328,6 +331,7 @@ static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = {
static CORE_ADDR static CORE_ADDR
hppa_linux_find_global_pointer (struct gdbarch *gdbarch, struct value *function) hppa_linux_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct obj_section *faddr_sect; struct obj_section *faddr_sect;
CORE_ADDR faddr; CORE_ADDR faddr;
@ -343,7 +347,7 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
status = target_read_memory (faddr + 4, buf, sizeof (buf)); status = target_read_memory (faddr + 4, buf, sizeof (buf));
if (status == 0) if (status == 0)
return extract_unsigned_integer (buf, sizeof (buf)); return extract_unsigned_integer (buf, sizeof (buf), byte_order);
} }
/* If the address is in the plt section, then the real function hasn't /* If the address is in the plt section, then the real function hasn't
@ -379,7 +383,7 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
status = target_read_memory (addr, buf, sizeof (buf)); status = target_read_memory (addr, buf, sizeof (buf));
if (status != 0) if (status != 0)
break; break;
tag = extract_signed_integer (buf, sizeof (buf)); tag = extract_signed_integer (buf, sizeof (buf), byte_order);
if (tag == DT_PLTGOT) if (tag == DT_PLTGOT)
{ {
@ -388,8 +392,8 @@ hppa_linux_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
status = target_read_memory (addr + 4, buf, sizeof (buf)); status = target_read_memory (addr + 4, buf, sizeof (buf));
if (status != 0) if (status != 0)
break; break;
global_pointer = extract_unsigned_integer (buf, sizeof (buf)); global_pointer = extract_unsigned_integer (buf, sizeof (buf),
byte_order);
/* The payoff... */ /* The payoff... */
return global_pointer; return global_pointer;
} }

View file

@ -540,6 +540,7 @@ find_unwind_entry (CORE_ADDR pc)
static int static int
hppa_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) hppa_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned long status; unsigned long status;
unsigned int inst; unsigned int inst;
char buf[4]; char buf[4];
@ -549,7 +550,7 @@ hppa_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
if (status != 0) if (status != 0)
return 0; return 0;
inst = extract_unsigned_integer (buf, 4); inst = extract_unsigned_integer (buf, 4, byte_order);
/* The most common way to perform a stack adjustment ldo X(sp),sp /* The most common way to perform a stack adjustment ldo X(sp),sp
We are destroying a stack frame if the offset is negative. */ We are destroying a stack frame if the offset is negative. */
@ -690,6 +691,8 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Stack base address at which any pass-by-reference parameters are /* Stack base address at which any pass-by-reference parameters are
stored. */ stored. */
CORE_ADDR struct_end = 0; CORE_ADDR struct_end = 0;
@ -737,7 +740,8 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (write_pass) if (write_pass)
write_memory (struct_end - struct_ptr, value_contents (arg), write_memory (struct_end - struct_ptr, value_contents (arg),
TYPE_LENGTH (type)); TYPE_LENGTH (type));
store_unsigned_integer (param_val, 4, struct_end - struct_ptr); store_unsigned_integer (param_val, 4, byte_order,
struct_end - struct_ptr);
} }
else if (TYPE_CODE (type) == TYPE_CODE_INT else if (TYPE_CODE (type) == TYPE_CODE_INT
|| TYPE_CODE (type) == TYPE_CODE_ENUM) || TYPE_CODE (type) == TYPE_CODE_ENUM)
@ -745,7 +749,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Integer value store, right aligned. "unpack_long" /* Integer value store, right aligned. "unpack_long"
takes care of any sign-extension problems. */ takes care of any sign-extension problems. */
param_len = align_up (TYPE_LENGTH (type), 4); param_len = align_up (TYPE_LENGTH (type), 4);
store_unsigned_integer (param_val, param_len, store_unsigned_integer (param_val, param_len, byte_order,
unpack_long (type, unpack_long (type,
value_contents (arg))); value_contents (arg)));
} }
@ -898,8 +902,9 @@ hppa64_floating_p (const struct type *type)
function descriptor and return its address instead. If CODE is not a function descriptor and return its address instead. If CODE is not a
function entry address, then just return it unchanged. */ function entry address, then just return it unchanged. */
static CORE_ADDR static CORE_ADDR
hppa64_convert_code_addr_to_fptr (CORE_ADDR code) hppa64_convert_code_addr_to_fptr (struct gdbarch *gdbarch, CORE_ADDR code)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct obj_section *sec, *opd; struct obj_section *sec, *opd;
sec = find_pc_section (code); sec = find_pc_section (code);
@ -930,7 +935,7 @@ hppa64_convert_code_addr_to_fptr (CORE_ADDR code)
if (target_read_memory (addr, tmp, sizeof (tmp))) if (target_read_memory (addr, tmp, sizeof (tmp)))
break; break;
opdaddr = extract_unsigned_integer (tmp, sizeof (tmp)); opdaddr = extract_unsigned_integer (tmp, sizeof (tmp), byte_order);
if (opdaddr == code) if (opdaddr == code)
return addr - 16; return addr - 16;
@ -947,6 +952,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i, offset = 0; int i, offset = 0;
CORE_ADDR gp; CORE_ADDR gp;
@ -1044,8 +1050,9 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
ULONGEST codeptr, fptr; ULONGEST codeptr, fptr;
codeptr = unpack_long (type, value_contents (arg)); codeptr = unpack_long (type, value_contents (arg));
fptr = hppa64_convert_code_addr_to_fptr (codeptr); fptr = hppa64_convert_code_addr_to_fptr (gdbarch, codeptr);
store_unsigned_integer (fptrbuf, TYPE_LENGTH (type), fptr); store_unsigned_integer (fptrbuf, TYPE_LENGTH (type), byte_order,
fptr);
valbuf = fptrbuf; valbuf = fptrbuf;
} }
else else
@ -1476,6 +1483,7 @@ static CORE_ADDR
skip_prologue_hard_way (struct gdbarch *gdbarch, CORE_ADDR pc, skip_prologue_hard_way (struct gdbarch *gdbarch, CORE_ADDR pc,
int stop_before_branch) int stop_before_branch)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
char buf[4]; char buf[4];
CORE_ADDR orig_pc = pc; CORE_ADDR orig_pc = pc;
unsigned long inst, stack_remaining, save_gr, save_fr, save_rp, save_sp; unsigned long inst, stack_remaining, save_gr, save_fr, save_rp, save_sp;
@ -1557,7 +1565,7 @@ restart:
old_stack_remaining = stack_remaining; old_stack_remaining = stack_remaining;
status = target_read_memory (pc, buf, 4); status = target_read_memory (pc, buf, 4);
inst = extract_unsigned_integer (buf, 4); inst = extract_unsigned_integer (buf, 4, byte_order);
/* Yow! */ /* Yow! */
if (status != 0) if (status != 0)
@ -1608,7 +1616,7 @@ restart:
{ {
pc += 4; pc += 4;
status = target_read_memory (pc, buf, 4); status = target_read_memory (pc, buf, 4);
inst = extract_unsigned_integer (buf, 4); inst = extract_unsigned_integer (buf, 4, byte_order);
if (status != 0) if (status != 0)
return pc; return pc;
reg_num = inst_saves_gr (inst); reg_num = inst_saves_gr (inst);
@ -1621,7 +1629,7 @@ restart:
save_fr &= ~(1 << reg_num); save_fr &= ~(1 << reg_num);
status = target_read_memory (pc + 4, buf, 4); status = target_read_memory (pc + 4, buf, 4);
next_inst = extract_unsigned_integer (buf, 4); next_inst = extract_unsigned_integer (buf, 4, byte_order);
/* Yow! */ /* Yow! */
if (status != 0) if (status != 0)
@ -1652,13 +1660,13 @@ restart:
{ {
pc += 8; pc += 8;
status = target_read_memory (pc, buf, 4); status = target_read_memory (pc, buf, 4);
inst = extract_unsigned_integer (buf, 4); inst = extract_unsigned_integer (buf, 4, byte_order);
if (status != 0) if (status != 0)
return pc; return pc;
if ((inst & 0xfc000000) != 0x34000000) if ((inst & 0xfc000000) != 0x34000000)
break; break;
status = target_read_memory (pc + 4, buf, 4); status = target_read_memory (pc + 4, buf, 4);
next_inst = extract_unsigned_integer (buf, 4); next_inst = extract_unsigned_integer (buf, 4, byte_order);
if (status != 0) if (status != 0)
return pc; return pc;
reg_num = inst_saves_fr (next_inst); reg_num = inst_saves_fr (next_inst);
@ -1816,6 +1824,8 @@ static struct hppa_frame_cache *
hppa_frame_cache (struct frame_info *this_frame, void **this_cache) hppa_frame_cache (struct frame_info *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);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
struct hppa_frame_cache *cache; struct hppa_frame_cache *cache;
long saved_gr_mask; long saved_gr_mask;
long saved_fr_mask; long saved_fr_mask;
@ -1940,7 +1950,7 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
return (*this_cache); return (*this_cache);
} }
inst = extract_unsigned_integer (buf4, sizeof buf4); inst = extract_unsigned_integer (buf4, sizeof buf4, byte_order);
/* Note the interesting effects of this instruction. */ /* Note the interesting effects of this instruction. */
frame_size += prologue_inst_adjust_sp (inst); frame_size += prologue_inst_adjust_sp (inst);
@ -2109,8 +2119,7 @@ hppa_frame_cache (struct frame_info *this_frame, void **this_cache)
/* Both we're expecting the SP to be saved and the SP has been /* Both we're expecting the SP to be saved and the SP has been
saved. The entry SP value is saved at this frame's SP saved. The entry SP value is saved at this frame's SP
address. */ address. */
cache->base = read_memory_integer cache->base = read_memory_integer (this_sp, word_size, byte_order);
(this_sp, gdbarch_ptr_bit (gdbarch) / 8);
if (hppa_debug) if (hppa_debug)
fprintf_unfiltered (gdb_stdlog, " (base=%s) [saved]", fprintf_unfiltered (gdb_stdlog, " (base=%s) [saved]",
@ -2265,6 +2274,8 @@ static const struct frame_unwind hppa_frame_unwind =
static struct hppa_frame_cache * static struct hppa_frame_cache *
hppa_fallback_frame_cache (struct frame_info *this_frame, void **this_cache) hppa_fallback_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct hppa_frame_cache *cache; struct hppa_frame_cache *cache;
unsigned int frame_size = 0; unsigned int frame_size = 0;
int found_rp = 0; int found_rp = 0;
@ -2289,7 +2300,7 @@ hppa_fallback_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
unsigned int insn; unsigned int insn;
insn = read_memory_unsigned_integer (pc, 4); insn = read_memory_unsigned_integer (pc, 4, byte_order);
frame_size += prologue_inst_adjust_sp (insn); frame_size += prologue_inst_adjust_sp (insn);
/* There are limited ways to store the return pointer into the /* There are limited ways to store the return pointer into the
@ -2444,7 +2455,7 @@ hppa_stub_unwind_sniffer (const struct frame_unwind *self,
if (pc == 0 if (pc == 0
|| (tdep->in_solib_call_trampoline != NULL || (tdep->in_solib_call_trampoline != NULL
&& tdep->in_solib_call_trampoline (pc, NULL)) && tdep->in_solib_call_trampoline (gdbarch, pc, NULL))
|| gdbarch_in_solib_return_trampoline (gdbarch, pc, NULL)) || gdbarch_in_solib_return_trampoline (gdbarch, pc, NULL))
return 1; return 1;
return 0; return 0;
@ -2690,12 +2701,13 @@ static void
hppa_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, hppa_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, gdb_byte *buf) int regnum, gdb_byte *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST tmp; ULONGEST tmp;
regcache_raw_read_unsigned (regcache, regnum, &tmp); regcache_raw_read_unsigned (regcache, regnum, &tmp);
if (regnum == HPPA_PCOQ_HEAD_REGNUM || regnum == HPPA_PCOQ_TAIL_REGNUM) if (regnum == HPPA_PCOQ_HEAD_REGNUM || regnum == HPPA_PCOQ_TAIL_REGNUM)
tmp &= ~0x3; tmp &= ~0x3;
store_unsigned_integer (buf, sizeof tmp, tmp); store_unsigned_integer (buf, sizeof tmp, byte_order, tmp);
} }
static CORE_ADDR static CORE_ADDR
@ -2710,6 +2722,7 @@ hppa_frame_prev_register_helper (struct frame_info *this_frame,
int regnum) int regnum)
{ {
struct gdbarch *arch = get_frame_arch (this_frame); struct gdbarch *arch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (arch);
if (regnum == HPPA_PCOQ_TAIL_REGNUM) if (regnum == HPPA_PCOQ_TAIL_REGNUM)
{ {
@ -2719,7 +2732,8 @@ hppa_frame_prev_register_helper (struct frame_info *this_frame,
trad_frame_get_prev_register (this_frame, saved_regs, trad_frame_get_prev_register (this_frame, saved_regs,
HPPA_PCOQ_HEAD_REGNUM); HPPA_PCOQ_HEAD_REGNUM);
pc = extract_unsigned_integer (value_contents_all (pcoq_val), size); pc = extract_unsigned_integer (value_contents_all (pcoq_val),
size, byte_order);
return frame_unwind_got_constant (this_frame, regnum, pc + 4); return frame_unwind_got_constant (this_frame, regnum, pc + 4);
} }
@ -2817,9 +2831,10 @@ static struct insn_pattern hppa_sigtramp[] = {
matched. */ matched. */
static int static int
hppa_match_insns (CORE_ADDR pc, struct insn_pattern *pattern, hppa_match_insns (struct gdbarch *gdbarch, CORE_ADDR pc,
unsigned int *insn) struct insn_pattern *pattern, unsigned int *insn)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR npc = pc; CORE_ADDR npc = pc;
int i; int i;
@ -2828,7 +2843,7 @@ hppa_match_insns (CORE_ADDR pc, struct insn_pattern *pattern,
gdb_byte buf[HPPA_INSN_SIZE]; gdb_byte buf[HPPA_INSN_SIZE];
target_read_memory (npc, buf, HPPA_INSN_SIZE); target_read_memory (npc, buf, HPPA_INSN_SIZE);
insn[i] = extract_unsigned_integer (buf, HPPA_INSN_SIZE); insn[i] = extract_unsigned_integer (buf, HPPA_INSN_SIZE, byte_order);
if ((insn[i] & pattern[i].mask) == pattern[i].data) if ((insn[i] & pattern[i].mask) == pattern[i].data)
npc += 4; npc += 4;
else else
@ -2843,8 +2858,8 @@ hppa_match_insns (CORE_ADDR pc, struct insn_pattern *pattern,
instruction scheme. */ instruction scheme. */
static int static int
hppa_match_insns_relaxed (CORE_ADDR pc, struct insn_pattern *pattern, hppa_match_insns_relaxed (struct gdbarch *gdbarch, CORE_ADDR pc,
unsigned int *insn) struct insn_pattern *pattern, unsigned int *insn)
{ {
int offset, len = 0; int offset, len = 0;
@ -2852,7 +2867,8 @@ hppa_match_insns_relaxed (CORE_ADDR pc, struct insn_pattern *pattern,
len++; len++;
for (offset = 0; offset < len; offset++) for (offset = 0; offset < len; offset++)
if (hppa_match_insns (pc - offset * HPPA_INSN_SIZE, pattern, insn)) if (hppa_match_insns (gdbarch, pc - offset * HPPA_INSN_SIZE,
pattern, insn))
return 1; return 1;
return 0; return 0;
@ -2871,7 +2887,8 @@ hppa_in_dyncall (CORE_ADDR pc)
} }
int int
hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name) hppa_in_solib_call_trampoline (struct gdbarch *gdbarch,
CORE_ADDR pc, char *name)
{ {
unsigned int insn[HPPA_MAX_INSN_PATTERN_LEN]; unsigned int insn[HPPA_MAX_INSN_PATTERN_LEN];
struct unwind_table_entry *u; struct unwind_table_entry *u;
@ -2887,10 +2904,12 @@ hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name)
if (u != NULL) if (u != NULL)
return 0; return 0;
return (hppa_match_insns_relaxed (pc, hppa_import_stub, insn) return
|| hppa_match_insns_relaxed (pc, hppa_import_pic_stub, insn) (hppa_match_insns_relaxed (gdbarch, pc, hppa_import_stub, insn)
|| hppa_match_insns_relaxed (pc, hppa_long_branch_stub, insn) || hppa_match_insns_relaxed (gdbarch, pc, hppa_import_pic_stub, insn)
|| hppa_match_insns_relaxed (pc, hppa_long_branch_pic_stub, insn)); || hppa_match_insns_relaxed (gdbarch, pc, hppa_long_branch_stub, insn)
|| hppa_match_insns_relaxed (gdbarch, pc,
hppa_long_branch_pic_stub, insn));
} }
/* This code skips several kind of "trampolines" used on PA-RISC /* This code skips several kind of "trampolines" used on PA-RISC
@ -2917,8 +2936,8 @@ hppa_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
return pc; return pc;
} }
dp_rel = hppa_match_insns (pc, hppa_import_stub, insn); dp_rel = hppa_match_insns (gdbarch, pc, hppa_import_stub, insn);
if (dp_rel || hppa_match_insns (pc, hppa_import_pic_stub, insn)) if (dp_rel || hppa_match_insns (gdbarch, pc, hppa_import_pic_stub, insn))
{ {
/* Extract the target address from the addil/ldw sequence. */ /* Extract the target address from the addil/ldw sequence. */
pc = hppa_extract_21 (insn[0]) + hppa_extract_14 (insn[1]); pc = hppa_extract_21 (insn[0]) + hppa_extract_14 (insn[1]);
@ -2940,7 +2959,7 @@ hppa_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
if (in_plt_section (pc, NULL)) if (in_plt_section (pc, NULL))
{ {
/* Sanity check: are we pointing to the PLT stub? */ /* Sanity check: are we pointing to the PLT stub? */
if (!hppa_match_insns (pc, hppa_plt_stub, insn)) if (!hppa_match_insns (gdbarch, pc, hppa_plt_stub, insn))
{ {
warning (_("Cannot resolve PLT stub at %s."), warning (_("Cannot resolve PLT stub at %s."),
paddress (gdbarch, pc)); paddress (gdbarch, pc));

View file

@ -93,7 +93,8 @@ struct gdbarch_tdep
trampoline code in the ".plt", or equivalent, section. trampoline code in the ".plt", or equivalent, section.
IN_SOLIB_CALL_TRAMPOLINE evaluates to nonzero if we are currently IN_SOLIB_CALL_TRAMPOLINE evaluates to nonzero if we are currently
stopped in one of these. */ stopped in one of these. */
int (*in_solib_call_trampoline) (CORE_ADDR pc, char *name); int (*in_solib_call_trampoline) (struct gdbarch *gdbarch,
CORE_ADDR pc, char *name);
/* For targets that support multiple spaces, we may have additional stubs /* For targets that support multiple spaces, we may have additional stubs
in the return path. These stubs are internal to the ABI, and users are in the return path. These stubs are internal to the ABI, and users are
@ -241,7 +242,8 @@ extern struct minimal_symbol *
extern struct hppa_objfile_private * extern struct hppa_objfile_private *
hppa_init_objfile_priv_data (struct objfile *objfile); hppa_init_objfile_priv_data (struct objfile *objfile);
extern int hppa_in_solib_call_trampoline (CORE_ADDR pc, char *name); extern int hppa_in_solib_call_trampoline (struct gdbarch *gdbarch,
CORE_ADDR pc, char *name);
extern CORE_ADDR hppa_skip_trampoline_code (struct frame_info *, CORE_ADDR pc); extern CORE_ADDR hppa_skip_trampoline_code (struct frame_info *, CORE_ADDR pc);
#endif /* hppa-tdep.h */ #endif /* hppa-tdep.h */

View file

@ -32,6 +32,7 @@
static CORE_ADDR static CORE_ADDR
hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function) hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR faddr = value_as_address (function); CORE_ADDR faddr = value_as_address (function);
struct obj_section *faddr_sec; struct obj_section *faddr_sec;
gdb_byte buf[4]; gdb_byte buf[4];
@ -41,7 +42,7 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
if (faddr & 2) if (faddr & 2)
{ {
if (target_read_memory ((faddr & ~3) + 4, buf, sizeof buf) == 0) if (target_read_memory ((faddr & ~3) + 4, buf, sizeof buf) == 0)
return extract_unsigned_integer (buf, sizeof buf); return extract_unsigned_integer (buf, sizeof buf, byte_order);
} }
/* If the address is in the .plt section, then the real function /* If the address is in the .plt section, then the real function
@ -74,7 +75,7 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
if (target_read_memory (addr, buf, sizeof buf) != 0) if (target_read_memory (addr, buf, sizeof buf) != 0)
break; break;
tag = extract_signed_integer (buf, sizeof buf); tag = extract_signed_integer (buf, sizeof buf, byte_order);
if (tag == DT_PLTGOT) if (tag == DT_PLTGOT)
{ {
CORE_ADDR pltgot; CORE_ADDR pltgot;
@ -84,7 +85,8 @@ hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function)
/* The NetBSD/OpenBSD ld.so doesn't relocate DT_PLTGOT, so /* The NetBSD/OpenBSD ld.so doesn't relocate DT_PLTGOT, so
we have to do it ourselves. */ we have to do it ourselves. */
pltgot = extract_unsigned_integer (buf, sizeof buf); pltgot = extract_unsigned_integer (buf, sizeof buf,
byte_order);
pltgot += ANOFFSET (sec->objfile->section_offsets, pltgot += ANOFFSET (sec->objfile->section_offsets,
SECT_OFF_TEXT (sec->objfile)); SECT_OFF_TEXT (sec->objfile));

View file

@ -243,6 +243,7 @@ hpux_thread_fetch_registers (struct target_ops *ops,
struct regcache *regcache, int regno) struct regcache *regcache, int regno)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
cma__t_int_tcb tcb, *tcb_ptr; cma__t_int_tcb tcb, *tcb_ptr;
struct cleanup *old_chain; struct cleanup *old_chain;
int i; int i;
@ -291,7 +292,7 @@ hpux_thread_fetch_registers (struct target_ops *ops,
/* Flags must be 0 to avoid bogus value for SS_INSYSCALL */ /* Flags must be 0 to avoid bogus value for SS_INSYSCALL */
memset (buf, '\000', register_size (gdbarch, regno)); memset (buf, '\000', register_size (gdbarch, regno));
else if (regno == HPPA_SP_REGNUM) else if (regno == HPPA_SP_REGNUM)
store_unsigned_integer (buf, sizeof sp, sp); store_unsigned_integer (buf, sizeof sp, byte_order, sp);
else if (regno == HPPA_PCOQ_HEAD_REGNUM) else if (regno == HPPA_PCOQ_HEAD_REGNUM)
read_memory (sp - 20, buf, register_size (gdbarch, regno)); read_memory (sp - 20, buf, register_size (gdbarch, regno));
else else

View file

@ -122,6 +122,7 @@ static void
core_process_module_section (bfd *abfd, asection *sect, void *obj) core_process_module_section (bfd *abfd, asection *sect, void *obj)
{ {
struct cpms_data *data = obj; struct cpms_data *data = obj;
enum bfd_endian byte_order = gdbarch_byte_order (data->gdbarch);
char *module_name; char *module_name;
size_t module_name_size; size_t module_name_size;
@ -147,10 +148,10 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
/* A DWORD (data_type) followed by struct windows_core_module_info. */ /* A DWORD (data_type) followed by struct windows_core_module_info. */
base_addr = base_addr =
extract_unsigned_integer (buf + 4, 4); extract_unsigned_integer (buf + 4, 4, byte_order);
module_name_size = module_name_size =
extract_unsigned_integer (buf + 8, 4); extract_unsigned_integer (buf + 8, 4, byte_order);
module_name = buf + 12; module_name = buf + 12;
if (module_name - buf + module_name_size > bfd_get_section_size (sect)) if (module_name - buf + module_name_size > bfd_get_section_size (sect))
@ -201,7 +202,7 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch,
static CORE_ADDR static CORE_ADDR
i386_cygwin_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) i386_cygwin_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{ {
return i386_pe_skip_trampoline_code (pc, NULL); return i386_pe_skip_trampoline_code (frame, pc, NULL);
} }
static void static void

View file

@ -446,6 +446,7 @@ darwin_check_osabi (darwin_inferior *inf, thread_t thread)
static int static int
i386_darwin_sstep_at_sigreturn (x86_thread_state_t *regs) i386_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
static const gdb_byte darwin_syscall[] = { 0xcd, 0x80 }; /* int 0x80 */ static const gdb_byte darwin_syscall[] = { 0xcd, 0x80 }; /* int 0x80 */
gdb_byte buf[sizeof (darwin_syscall)]; gdb_byte buf[sizeof (darwin_syscall)];
@ -459,8 +460,10 @@ i386_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
ULONGEST flags_addr; ULONGEST flags_addr;
unsigned int eflags; unsigned int eflags;
uctx_addr = read_memory_unsigned_integer (regs->uts.ts32.__esp + 4, 4); uctx_addr = read_memory_unsigned_integer
mctx_addr = read_memory_unsigned_integer (uctx_addr + 28, 4); (regs->uts.ts32.__esp + 4, 4, byte_order);
mctx_addr = read_memory_unsigned_integer
(uctx_addr + 28, 4, byte_order);
flags_addr = mctx_addr + 12 + 9 * 4; flags_addr = mctx_addr + 12 + 9 * 4;
read_memory (flags_addr, (gdb_byte *) &eflags, 4); read_memory (flags_addr, (gdb_byte *) &eflags, 4);
@ -475,6 +478,7 @@ i386_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
static int static int
amd64_darwin_sstep_at_sigreturn (x86_thread_state_t *regs) amd64_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
static const gdb_byte darwin_syscall[] = { 0x0f, 0x05 }; /* syscall */ static const gdb_byte darwin_syscall[] = { 0x0f, 0x05 }; /* syscall */
gdb_byte buf[sizeof (darwin_syscall)]; gdb_byte buf[sizeof (darwin_syscall)];
@ -487,7 +491,8 @@ amd64_darwin_sstep_at_sigreturn (x86_thread_state_t *regs)
ULONGEST flags_addr; ULONGEST flags_addr;
unsigned int rflags; unsigned int rflags;
mctx_addr = read_memory_unsigned_integer (regs->uts.ts64.__rdi + 48, 8); mctx_addr = read_memory_unsigned_integer
(regs->uts.ts64.__rdi + 48, 8, byte_order);
flags_addr = mctx_addr + 16 + 17 * 8; flags_addr = mctx_addr + 16 + 17 * 8;
/* AMD64 is little endian. */ /* AMD64 is little endian. */

View file

@ -107,28 +107,32 @@ const int amd64_darwin_thread_state_num_regs =
static CORE_ADDR static CORE_ADDR
i386_darwin_sigcontext_addr (struct frame_info *this_frame) i386_darwin_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR bp; CORE_ADDR bp;
CORE_ADDR si; CORE_ADDR si;
gdb_byte buf[4]; gdb_byte buf[4];
get_frame_register (this_frame, I386_EBP_REGNUM, buf); get_frame_register (this_frame, I386_EBP_REGNUM, buf);
bp = extract_unsigned_integer (buf, 4); bp = extract_unsigned_integer (buf, 4, byte_order);
/* A pointer to the ucontext is passed as the fourth argument /* A pointer to the ucontext is passed as the fourth argument
to the signal handler. */ to the signal handler. */
read_memory (bp + 24, buf, 4); read_memory (bp + 24, buf, 4);
si = extract_unsigned_integer (buf, 4); si = extract_unsigned_integer (buf, 4, byte_order);
/* The pointer to mcontext is at offset 28. */ /* The pointer to mcontext is at offset 28. */
read_memory (si + 28, buf, 4); read_memory (si + 28, buf, 4);
/* First register (eax) is at offset 12. */ /* First register (eax) is at offset 12. */
return extract_unsigned_integer (buf, 4) + 12; return extract_unsigned_integer (buf, 4, byte_order) + 12;
} }
static CORE_ADDR static CORE_ADDR
amd64_darwin_sigcontext_addr (struct frame_info *this_frame) amd64_darwin_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR rbx; CORE_ADDR rbx;
CORE_ADDR si; CORE_ADDR si;
gdb_byte buf[8]; gdb_byte buf[8];
@ -136,13 +140,13 @@ amd64_darwin_sigcontext_addr (struct frame_info *this_frame)
/* A pointer to the ucontext is passed as the fourth argument /* A pointer to the ucontext is passed as the fourth argument
to the signal handler, which is saved in rbx. */ to the signal handler, which is saved in rbx. */
get_frame_register (this_frame, AMD64_RBX_REGNUM, buf); get_frame_register (this_frame, AMD64_RBX_REGNUM, buf);
rbx = extract_unsigned_integer (buf, 8); rbx = extract_unsigned_integer (buf, 8, byte_order);
/* The pointer to mcontext is at offset 48. */ /* The pointer to mcontext is at offset 48. */
read_memory (rbx + 48, buf, 8); read_memory (rbx + 48, buf, 8);
/* First register (rax) is at offset 16. */ /* First register (rax) is at offset 16. */
return extract_unsigned_integer (buf, 8) + 16; return extract_unsigned_integer (buf, 8, byte_order) + 16;
} }
/* Return true if the PC of THIS_FRAME is in a signal trampoline which /* Return true if the PC of THIS_FRAME is in a signal trampoline which

View file

@ -757,13 +757,15 @@ i386_linux_resume (struct target_ops *ops,
if (step) if (step)
{ {
struct regcache *regcache = get_thread_regcache (pid_to_ptid (pid)); struct regcache *regcache = get_thread_regcache (pid_to_ptid (pid));
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST pc; ULONGEST pc;
gdb_byte buf[LINUX_SYSCALL_LEN]; gdb_byte buf[LINUX_SYSCALL_LEN];
request = PTRACE_SINGLESTEP; request = PTRACE_SINGLESTEP;
regcache_cooked_read_unsigned regcache_cooked_read_unsigned (regcache,
(regcache, gdbarch_pc_regnum (get_regcache_arch (regcache)), &pc); gdbarch_pc_regnum (gdbarch), &pc);
/* Returning from a signal trampoline is done by calling a /* Returning from a signal trampoline is done by calling a
special system call (sigreturn or rt_sigreturn, see special system call (sigreturn or rt_sigreturn, see
@ -789,7 +791,7 @@ i386_linux_resume (struct target_ops *ops,
regcache_cooked_read_unsigned (regcache, I386_ESP_REGNUM, &sp); regcache_cooked_read_unsigned (regcache, I386_ESP_REGNUM, &sp);
if (syscall == SYS_rt_sigreturn) if (syscall == SYS_rt_sigreturn)
addr = read_memory_integer (sp + 8, 4) + 20; addr = read_memory_integer (sp + 8, 4, byte_order) + 20;
else else
addr = sp; addr = sp;

View file

@ -290,12 +290,14 @@ i386_linux_dwarf_signal_frame_p (struct gdbarch *gdbarch,
static CORE_ADDR static CORE_ADDR
i386_linux_sigcontext_addr (struct frame_info *this_frame) i386_linux_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc; CORE_ADDR pc;
CORE_ADDR sp; CORE_ADDR sp;
gdb_byte buf[4]; gdb_byte buf[4];
get_frame_register (this_frame, I386_ESP_REGNUM, buf); get_frame_register (this_frame, I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4); sp = extract_unsigned_integer (buf, 4, byte_order);
pc = i386_linux_sigtramp_start (this_frame); pc = i386_linux_sigtramp_start (this_frame);
if (pc) if (pc)
@ -320,7 +322,7 @@ i386_linux_sigcontext_addr (struct frame_info *this_frame)
pointer to the user context is passed as the third argument pointer to the user context is passed as the third argument
to the signal handler. */ to the signal handler. */
read_memory (sp + 8, buf, 4); read_memory (sp + 8, buf, 4);
ucontext_addr = extract_unsigned_integer (buf, 4); ucontext_addr = extract_unsigned_integer (buf, 4, byte_order);
return ucontext_addr + I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET; return ucontext_addr + I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
} }

View file

@ -293,12 +293,14 @@ i386nto_sigtramp_p (struct frame_info *this_frame)
static CORE_ADDR static CORE_ADDR
i386nto_sigcontext_addr (struct frame_info *this_frame) i386nto_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
char buf[4]; char buf[4];
CORE_ADDR ptrctx; CORE_ADDR ptrctx;
/* We store __ucontext_t addr in EDI register. */ /* We store __ucontext_t addr in EDI register. */
get_frame_register (this_frame, I386_EDI_REGNUM, buf); get_frame_register (this_frame, I386_EDI_REGNUM, buf);
ptrctx = extract_unsigned_integer (buf, 4); ptrctx = extract_unsigned_integer (buf, 4, byte_order);
ptrctx += 24 /* Context pointer is at this offset. */; ptrctx += 24 /* Context pointer is at this offset. */;
return ptrctx; return ptrctx;

View file

@ -414,6 +414,8 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch,
CORE_ADDR from, CORE_ADDR to, CORE_ADDR from, CORE_ADDR to,
struct regcache *regs) struct regcache *regs)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* The offset we applied to the instruction's address. /* The offset we applied to the instruction's address.
This could well be negative (when viewed as a signed 32-bit This could well be negative (when viewed as a signed 32-bit
value), but ULONGEST won't reflect that, so take care when value), but ULONGEST won't reflect that, so take care when
@ -521,9 +523,9 @@ i386_displaced_step_fixup (struct gdbarch *gdbarch,
const ULONGEST retaddr_len = 4; const ULONGEST retaddr_len = 4;
regcache_cooked_read_unsigned (regs, I386_ESP_REGNUM, &esp); regcache_cooked_read_unsigned (regs, I386_ESP_REGNUM, &esp);
retaddr = read_memory_unsigned_integer (esp, retaddr_len); retaddr = read_memory_unsigned_integer (esp, byte_order, retaddr_len);
retaddr = (retaddr - insn_offset) & 0xffffffffUL; retaddr = (retaddr - insn_offset) & 0xffffffffUL;
write_memory_unsigned_integer (esp, retaddr_len, retaddr); write_memory_unsigned_integer (esp, retaddr_len, byte_order, retaddr);
if (debug_displaced) if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
@ -595,8 +597,9 @@ i386_alloc_frame_cache (void)
target. Otherwise, return PC. */ target. Otherwise, return PC. */
static CORE_ADDR static CORE_ADDR
i386_follow_jump (CORE_ADDR pc) i386_follow_jump (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte op; gdb_byte op;
long delta = 0; long delta = 0;
int data16 = 0; int data16 = 0;
@ -605,7 +608,7 @@ i386_follow_jump (CORE_ADDR pc)
if (op == 0x66) if (op == 0x66)
{ {
data16 = 1; data16 = 1;
op = read_memory_unsigned_integer (pc + 1, 1); op = read_memory_unsigned_integer (pc + 1, 1, byte_order);
} }
switch (op) switch (op)
@ -614,7 +617,7 @@ i386_follow_jump (CORE_ADDR pc)
/* Relative jump: if data16 == 0, disp32, else disp16. */ /* Relative jump: if data16 == 0, disp32, else disp16. */
if (data16) if (data16)
{ {
delta = read_memory_integer (pc + 2, 2); delta = read_memory_integer (pc + 2, 2, byte_order);
/* Include the size of the jmp instruction (including the /* Include the size of the jmp instruction (including the
0x66 prefix). */ 0x66 prefix). */
@ -622,7 +625,7 @@ i386_follow_jump (CORE_ADDR pc)
} }
else else
{ {
delta = read_memory_integer (pc + 1, 4); delta = read_memory_integer (pc + 1, 4, byte_order);
/* Include the size of the jmp instruction. */ /* Include the size of the jmp instruction. */
delta += 5; delta += 5;
@ -630,7 +633,7 @@ i386_follow_jump (CORE_ADDR pc)
break; break;
case 0xeb: case 0xeb:
/* Relative jump, disp8 (ignore data16). */ /* Relative jump, disp8 (ignore data16). */
delta = read_memory_integer (pc + data16 + 1, 1); delta = read_memory_integer (pc + data16 + 1, 1, byte_order);
delta += data16 + 2; delta += data16 + 2;
break; break;
@ -1006,9 +1009,11 @@ i386_skip_noop (CORE_ADDR pc)
whichever is smaller. If we don't recognize the code, return PC. */ whichever is smaller. If we don't recognize the code, return PC. */
static CORE_ADDR static CORE_ADDR
i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR limit, i386_analyze_frame_setup (struct gdbarch *gdbarch,
CORE_ADDR pc, CORE_ADDR limit,
struct i386_frame_cache *cache) struct i386_frame_cache *cache)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct i386_insn *insn; struct i386_insn *insn;
gdb_byte op; gdb_byte op;
int skip = 0; int skip = 0;
@ -1057,11 +1062,13 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR limit,
switch (op) switch (op)
{ {
case 0x8b: case 0x8b:
if (read_memory_unsigned_integer (pc + skip + 1, 1) != 0xec) if (read_memory_unsigned_integer (pc + skip + 1, 1, byte_order)
!= 0xec)
return pc; return pc;
break; break;
case 0x89: case 0x89:
if (read_memory_unsigned_integer (pc + skip + 1, 1) != 0xe5) if (read_memory_unsigned_integer (pc + skip + 1, 1, byte_order)
!= 0xe5)
return pc; return pc;
break; break;
default: default:
@ -1089,24 +1096,24 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR limit,
if (op == 0x83) if (op == 0x83)
{ {
/* `subl' with 8-bit immediate. */ /* `subl' with 8-bit immediate. */
if (read_memory_unsigned_integer (pc + 1, 1) != 0xec) if (read_memory_unsigned_integer (pc + 1, 1, byte_order) != 0xec)
/* Some instruction starting with 0x83 other than `subl'. */ /* Some instruction starting with 0x83 other than `subl'. */
return pc; return pc;
/* `subl' with signed 8-bit immediate (though it wouldn't /* `subl' with signed 8-bit immediate (though it wouldn't
make sense to be negative). */ make sense to be negative). */
cache->locals = read_memory_integer (pc + 2, 1); cache->locals = read_memory_integer (pc + 2, 1, byte_order);
return pc + 3; return pc + 3;
} }
else if (op == 0x81) else if (op == 0x81)
{ {
/* Maybe it is `subl' with a 32-bit immediate. */ /* Maybe it is `subl' with a 32-bit immediate. */
if (read_memory_unsigned_integer (pc + 1, 1) != 0xec) if (read_memory_unsigned_integer (pc + 1, 1, byte_order) != 0xec)
/* Some instruction starting with 0x81 other than `subl'. */ /* Some instruction starting with 0x81 other than `subl'. */
return pc; return pc;
/* It is `subl' with a 32-bit immediate. */ /* It is `subl' with a 32-bit immediate. */
cache->locals = read_memory_integer (pc + 2, 4); cache->locals = read_memory_integer (pc + 2, 4, byte_order);
return pc + 6; return pc + 6;
} }
else else
@ -1117,7 +1124,7 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR limit,
} }
else if (op == 0xc8) /* enter */ else if (op == 0xc8) /* enter */
{ {
cache->locals = read_memory_unsigned_integer (pc + 1, 2); cache->locals = read_memory_unsigned_integer (pc + 1, 2, byte_order);
return pc + 4; return pc + 4;
} }
@ -1182,15 +1189,16 @@ i386_analyze_register_saves (CORE_ADDR pc, CORE_ADDR current_pc,
instruction will be a branch back to the start. */ instruction will be a branch back to the start. */
static CORE_ADDR static CORE_ADDR
i386_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc, i386_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR pc, CORE_ADDR current_pc,
struct i386_frame_cache *cache) struct i386_frame_cache *cache)
{ {
pc = i386_skip_noop (pc); pc = i386_skip_noop (pc);
pc = i386_follow_jump (pc); pc = i386_follow_jump (gdbarch, pc);
pc = i386_analyze_struct_return (pc, current_pc, cache); pc = i386_analyze_struct_return (pc, current_pc, cache);
pc = i386_skip_probe (pc); pc = i386_skip_probe (pc);
pc = i386_analyze_stack_align (pc, current_pc, cache); pc = i386_analyze_stack_align (pc, current_pc, cache);
pc = i386_analyze_frame_setup (pc, current_pc, cache); pc = i386_analyze_frame_setup (gdbarch, pc, current_pc, cache);
return i386_analyze_register_saves (pc, current_pc, cache); return i386_analyze_register_saves (pc, current_pc, cache);
} }
@ -1199,6 +1207,8 @@ i386_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
static CORE_ADDR static CORE_ADDR
i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
static gdb_byte pic_pat[6] = static gdb_byte pic_pat[6] =
{ {
0xe8, 0, 0, 0, 0, /* call 0x0 */ 0xe8, 0, 0, 0, 0, /* call 0x0 */
@ -1210,7 +1220,7 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
int i; int i;
cache.locals = -1; cache.locals = -1;
pc = i386_analyze_prologue (start_pc, 0xffffffff, &cache); pc = i386_analyze_prologue (gdbarch, start_pc, 0xffffffff, &cache);
if (cache.locals < 0) if (cache.locals < 0)
return start_pc; return start_pc;
@ -1243,7 +1253,7 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
if (op == 0x89) /* movl %ebx, x(%ebp) */ if (op == 0x89) /* movl %ebx, x(%ebp) */
{ {
op = read_memory_unsigned_integer (pc + delta + 1, 1); op = read_memory_unsigned_integer (pc + delta + 1, 1, byte_order);
if (op == 0x5d) /* One byte offset from %ebp. */ if (op == 0x5d) /* One byte offset from %ebp. */
delta += 3; delta += 3;
@ -1257,7 +1267,8 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
/* addl y,%ebx */ /* addl y,%ebx */
if (delta > 0 && op == 0x81 if (delta > 0 && op == 0x81
&& read_memory_unsigned_integer (pc + delta + 1, 1) == 0xc3) && read_memory_unsigned_integer (pc + delta + 1, 1, byte_order)
== 0xc3)
{ {
pc += delta + 6; pc += delta + 6;
} }
@ -1266,8 +1277,8 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
/* If the function starts with a branch (to startup code at the end) /* If the function starts with a branch (to startup code at the end)
the last instruction should bring us back to the first the last instruction should bring us back to the first
instruction of the real code. */ instruction of the real code. */
if (i386_follow_jump (start_pc) != start_pc) if (i386_follow_jump (gdbarch, start_pc) != start_pc)
pc = i386_follow_jump (pc); pc = i386_follow_jump (gdbarch, pc);
return pc; return pc;
} }
@ -1278,6 +1289,7 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
CORE_ADDR CORE_ADDR
i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte op; gdb_byte op;
target_read_memory (pc, &op, 1); target_read_memory (pc, &op, 1);
@ -1290,8 +1302,9 @@ i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* Make sure address is computed correctly as a 32bit /* Make sure address is computed correctly as a 32bit
integer even if CORE_ADDR is 64 bit wide. */ integer even if CORE_ADDR is 64 bit wide. */
struct minimal_symbol *s; struct minimal_symbol *s;
CORE_ADDR call_dest = pc + 5 + extract_signed_integer (buf, 4); CORE_ADDR call_dest;
call_dest = pc + 5 + extract_signed_integer (buf, 4, byte_order);
call_dest = call_dest & 0xffffffffU; call_dest = call_dest & 0xffffffffU;
s = lookup_minimal_symbol_by_pc (call_dest); s = lookup_minimal_symbol_by_pc (call_dest);
if (s != NULL if (s != NULL
@ -1321,6 +1334,8 @@ i386_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
static struct i386_frame_cache * static struct i386_frame_cache *
i386_frame_cache (struct frame_info *this_frame, void **this_cache) i386_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct i386_frame_cache *cache; struct i386_frame_cache *cache;
gdb_byte buf[4]; gdb_byte buf[4];
int i; int i;
@ -1341,7 +1356,7 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
in progress when the signal occurred. */ in progress when the signal occurred. */
get_frame_register (this_frame, I386_EBP_REGNUM, buf); get_frame_register (this_frame, I386_EBP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4); cache->base = extract_unsigned_integer (buf, 4, byte_order);
if (cache->base == 0) if (cache->base == 0)
return cache; return cache;
@ -1350,13 +1365,14 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->pc = get_frame_func (this_frame); cache->pc = get_frame_func (this_frame);
if (cache->pc != 0) if (cache->pc != 0)
i386_analyze_prologue (cache->pc, get_frame_pc (this_frame), cache); i386_analyze_prologue (gdbarch, cache->pc, get_frame_pc (this_frame),
cache);
if (cache->saved_sp_reg != -1) if (cache->saved_sp_reg != -1)
{ {
/* Saved stack pointer has been saved. */ /* Saved stack pointer has been saved. */
get_frame_register (this_frame, cache->saved_sp_reg, buf); get_frame_register (this_frame, cache->saved_sp_reg, buf);
cache->saved_sp = extract_unsigned_integer(buf, 4); cache->saved_sp = extract_unsigned_integer (buf, 4, byte_order);
} }
if (cache->locals < 0) if (cache->locals < 0)
@ -1381,7 +1397,8 @@ i386_frame_cache (struct frame_info *this_frame, void **this_cache)
else else
{ {
get_frame_register (this_frame, I386_ESP_REGNUM, buf); get_frame_register (this_frame, I386_ESP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4) + cache->sp_offset; cache->base = extract_unsigned_integer (buf, 4, byte_order)
+ cache->sp_offset;
} }
} }
@ -1477,8 +1494,10 @@ static const struct frame_unwind i386_frame_unwind =
static struct i386_frame_cache * static struct i386_frame_cache *
i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct i386_frame_cache *cache; struct i386_frame_cache *cache;
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
CORE_ADDR addr; CORE_ADDR addr;
gdb_byte buf[4]; gdb_byte buf[4];
@ -1488,7 +1507,7 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
cache = i386_alloc_frame_cache (); cache = i386_alloc_frame_cache ();
get_frame_register (this_frame, I386_ESP_REGNUM, buf); get_frame_register (this_frame, I386_ESP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4) - 4; cache->base = extract_unsigned_integer (buf, 4, byte_order) - 4;
addr = tdep->sigcontext_addr (this_frame); addr = tdep->sigcontext_addr (this_frame);
if (tdep->sc_reg_offset) if (tdep->sc_reg_offset)
@ -1612,6 +1631,7 @@ i386_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
gdb_byte buf[4]; gdb_byte buf[4];
CORE_ADDR sp, jb_addr; CORE_ADDR sp, jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int jb_pc_offset = gdbarch_tdep (gdbarch)->jb_pc_offset; int jb_pc_offset = gdbarch_tdep (gdbarch)->jb_pc_offset;
/* If JB_PC_OFFSET is -1, we have no way to find out where the /* If JB_PC_OFFSET is -1, we have no way to find out where the
@ -1620,15 +1640,15 @@ i386_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
return 0; return 0;
get_frame_register (frame, I386_ESP_REGNUM, buf); get_frame_register (frame, I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4); sp = extract_unsigned_integer (buf, 4, byte_order);
if (target_read_memory (sp + 4, buf, 4)) if (target_read_memory (sp + 4, buf, 4))
return 0; return 0;
jb_addr = extract_unsigned_integer (buf, 4); jb_addr = extract_unsigned_integer (buf, 4, byte_order);
if (target_read_memory (jb_addr + jb_pc_offset, buf, 4)) if (target_read_memory (jb_addr + jb_pc_offset, buf, 4))
return 0; return 0;
*pc = extract_unsigned_integer (buf, 4); *pc = extract_unsigned_integer (buf, 4, byte_order);
return 1; return 1;
} }
@ -1667,6 +1687,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value **args, CORE_ADDR sp, int struct_return, struct value **args, CORE_ADDR sp, int struct_return,
CORE_ADDR struct_addr) CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[4]; gdb_byte buf[4];
int i; int i;
int write_pass; int write_pass;
@ -1686,7 +1707,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (write_pass) if (write_pass)
{ {
/* Push value address. */ /* Push value address. */
store_unsigned_integer (buf, 4, struct_addr); store_unsigned_integer (buf, 4, byte_order, struct_addr);
write_memory (sp, buf, 4); write_memory (sp, buf, 4);
args_space_used += 4; args_space_used += 4;
} }
@ -1735,11 +1756,11 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Store return address. */ /* Store return address. */
sp -= 4; sp -= 4;
store_unsigned_integer (buf, 4, bp_addr); store_unsigned_integer (buf, 4, byte_order, bp_addr);
write_memory (sp, buf, 4); write_memory (sp, buf, 4);
/* Finally, update the stack pointer... */ /* Finally, update the stack pointer... */
store_unsigned_integer (buf, 4, sp); store_unsigned_integer (buf, 4, byte_order, sp);
regcache_cooked_write (regcache, I386_ESP_REGNUM, buf); regcache_cooked_write (regcache, I386_ESP_REGNUM, buf);
/* ...and fake a frame pointer. */ /* ...and fake a frame pointer. */
@ -2500,11 +2521,17 @@ i386_regset_from_core_section (struct gdbarch *gdbarch,
/* Stuff for WIN32 PE style DLL's but is pretty generic really. */ /* Stuff for WIN32 PE style DLL's but is pretty generic really. */
CORE_ADDR CORE_ADDR
i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name) i386_pe_skip_trampoline_code (struct frame_info *frame,
CORE_ADDR pc, char *name)
{ {
if (pc && read_memory_unsigned_integer (pc, 2) == 0x25ff) /* jmp *(dest) */ struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* jmp *(dest) */
if (pc && read_memory_unsigned_integer (pc, 2, byte_order) == 0x25ff)
{ {
unsigned long indirect = read_memory_unsigned_integer (pc + 2, 4); unsigned long indirect =
read_memory_unsigned_integer (pc + 2, 4, byte_order);
struct minimal_symbol *indsym = struct minimal_symbol *indsym =
indirect ? lookup_minimal_symbol_by_pc (indirect) : 0; indirect ? lookup_minimal_symbol_by_pc (indirect) : 0;
char *symname = indsym ? SYMBOL_LINKAGE_NAME (indsym) : 0; char *symname = indsym ? SYMBOL_LINKAGE_NAME (indsym) : 0;
@ -2513,7 +2540,8 @@ i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name)
{ {
if (strncmp (symname, "__imp_", 6) == 0 if (strncmp (symname, "__imp_", 6) == 0
|| strncmp (symname, "_imp_", 5) == 0) || strncmp (symname, "_imp_", 5) == 0)
return name ? 1 : read_memory_unsigned_integer (indirect, 4); return name ? 1 :
read_memory_unsigned_integer (indirect, 4, byte_order);
} }
} }
return 0; /* Not a trampoline. */ return 0; /* Not a trampoline. */
@ -2581,13 +2609,15 @@ i386_svr4_sigtramp_p (struct frame_info *this_frame)
static CORE_ADDR static CORE_ADDR
i386_svr4_sigcontext_addr (struct frame_info *this_frame) i386_svr4_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[4]; gdb_byte buf[4];
CORE_ADDR sp; CORE_ADDR sp;
get_frame_register (this_frame, I386_ESP_REGNUM, buf); get_frame_register (this_frame, I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4); sp = extract_unsigned_integer (buf, 4, byte_order);
return read_memory_unsigned_integer (sp + 8, 4); return read_memory_unsigned_integer (sp + 8, 4, byte_order);
} }
@ -2704,8 +2734,10 @@ static CORE_ADDR
i386_fetch_pointer_argument (struct frame_info *frame, int argi, i386_fetch_pointer_argument (struct frame_info *frame, int argi,
struct type *type) struct type *type)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp = get_frame_register_unsigned (frame, I386_ESP_REGNUM); CORE_ADDR sp = get_frame_register_unsigned (frame, I386_ESP_REGNUM);
return read_memory_unsigned_integer (sp + (4 * (argi + 1)), 4); return read_memory_unsigned_integer (sp + (4 * (argi + 1)), 4, byte_order);
} }
static void static void

View file

@ -178,7 +178,8 @@ extern struct type *i387_ext_type (struct gdbarch *gdbarch);
#define I386_MAX_INSN_LEN (16) #define I386_MAX_INSN_LEN (16)
/* Functions exported from i386-tdep.c. */ /* Functions exported from i386-tdep.c. */
extern CORE_ADDR i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name); extern CORE_ADDR i386_pe_skip_trampoline_code (struct frame_info *frame,
CORE_ADDR pc, char *name);
extern CORE_ADDR i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc); extern CORE_ADDR i386_skip_main_prologue (struct gdbarch *gdbarch, CORE_ADDR pc);
/* Return whether the THIS_FRAME corresponds to a sigtramp routine. */ /* Return whether the THIS_FRAME corresponds to a sigtramp routine. */

View file

@ -37,13 +37,15 @@
static CORE_ADDR static CORE_ADDR
i386bsd_sigcontext_addr (struct frame_info *this_frame) i386bsd_sigcontext_addr (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[4]; gdb_byte buf[4];
CORE_ADDR sp; CORE_ADDR sp;
get_frame_register (this_frame, I386_ESP_REGNUM, buf); get_frame_register (this_frame, I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4); sp = extract_unsigned_integer (buf, 4, byte_order);
return read_memory_unsigned_integer (sp + 8, 4); return read_memory_unsigned_integer (sp + 8, 4, byte_order);
} }

View file

@ -234,6 +234,7 @@ i386nbsd_sigtramp_cache_init (const struct tramp_frame *self,
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM); CORE_ADDR sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
CORE_ADDR base; CORE_ADDR base;
int *reg_offset; int *reg_offset;
@ -246,7 +247,7 @@ i386nbsd_sigtramp_cache_init (const struct tramp_frame *self,
num_regs = ARRAY_SIZE (i386nbsd_sc_reg_offset); num_regs = ARRAY_SIZE (i386nbsd_sc_reg_offset);
/* Read in the sigcontext address */ /* Read in the sigcontext address */
base = read_memory_unsigned_integer (sp + 8, 4); base = read_memory_unsigned_integer (sp + 8, 4, byte_order);
} }
else else
{ {
@ -254,7 +255,7 @@ i386nbsd_sigtramp_cache_init (const struct tramp_frame *self,
num_regs = ARRAY_SIZE (i386nbsd_mc_reg_offset); num_regs = ARRAY_SIZE (i386nbsd_mc_reg_offset);
/* Read in the ucontext address */ /* Read in the ucontext address */
base = read_memory_unsigned_integer (sp + 8, 4); base = read_memory_unsigned_integer (sp + 8, 4, byte_order);
/* offsetof(ucontext_t, uc_mcontext) == 36 */ /* offsetof(ucontext_t, uc_mcontext) == 36 */
base += 36; base += 36;
} }

View file

@ -35,6 +35,8 @@
static int static int
i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct switchframe sf; struct switchframe sf;
/* The following is true for OpenBSD 3.6: /* The following is true for OpenBSD 3.6:
@ -76,8 +78,8 @@ i386obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
{ {
/* No, the pcb must have been last updated by savectx(). */ /* No, the pcb must have been last updated by savectx(). */
pcb->pcb_esp = pcb->pcb_ebp; pcb->pcb_esp = pcb->pcb_ebp;
pcb->pcb_ebp = read_memory_integer(pcb->pcb_esp, 4); pcb->pcb_ebp = read_memory_integer(pcb->pcb_esp, 4, byte_order);
sf.sf_eip = read_memory_integer(pcb->pcb_esp + 4, 4); sf.sf_eip = read_memory_integer(pcb->pcb_esp + 4, 4, byte_order);
regcache_raw_supply (regcache, I386_EIP_REGNUM, &sf.sf_eip); regcache_raw_supply (regcache, I386_EIP_REGNUM, &sf.sf_eip);
} }

View file

@ -228,6 +228,8 @@ static void
i386obsd_supply_uthread (struct regcache *regcache, i386obsd_supply_uthread (struct regcache *regcache,
int regnum, CORE_ADDR addr) int regnum, CORE_ADDR addr)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp_addr = addr + I386OBSD_UTHREAD_ESP_OFFSET; CORE_ADDR sp_addr = addr + I386OBSD_UTHREAD_ESP_OFFSET;
CORE_ADDR sp = 0; CORE_ADDR sp = 0;
gdb_byte buf[4]; gdb_byte buf[4];
@ -240,12 +242,12 @@ i386obsd_supply_uthread (struct regcache *regcache,
int offset; int offset;
/* Fetch stack pointer from thread structure. */ /* Fetch stack pointer from thread structure. */
sp = read_memory_unsigned_integer (sp_addr, 4); sp = read_memory_unsigned_integer (sp_addr, 4, byte_order);
/* Adjust the stack pointer such that it looks as if we just /* Adjust the stack pointer such that it looks as if we just
returned from _thread_machdep_switch. */ returned from _thread_machdep_switch. */
offset = i386obsd_uthread_reg_offset[I386_EIP_REGNUM] + 4; offset = i386obsd_uthread_reg_offset[I386_EIP_REGNUM] + 4;
store_unsigned_integer (buf, 4, sp + offset); store_unsigned_integer (buf, 4, byte_order, sp + offset);
regcache_raw_supply (regcache, I386_ESP_REGNUM, buf); regcache_raw_supply (regcache, I386_ESP_REGNUM, buf);
} }
@ -257,7 +259,7 @@ i386obsd_supply_uthread (struct regcache *regcache,
/* Fetch stack pointer from thread structure (if we didn't /* Fetch stack pointer from thread structure (if we didn't
do so already). */ do so already). */
if (sp == 0) if (sp == 0)
sp = read_memory_unsigned_integer (sp_addr, 4); sp = read_memory_unsigned_integer (sp_addr, 4, byte_order);
/* Read the saved register from the stack frame. */ /* Read the saved register from the stack frame. */
read_memory (sp + i386obsd_uthread_reg_offset[i], buf, 4); read_memory (sp + i386obsd_uthread_reg_offset[i], buf, 4);
@ -270,6 +272,8 @@ static void
i386obsd_collect_uthread (const struct regcache *regcache, i386obsd_collect_uthread (const struct regcache *regcache,
int regnum, CORE_ADDR addr) int regnum, CORE_ADDR addr)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp_addr = addr + I386OBSD_UTHREAD_ESP_OFFSET; CORE_ADDR sp_addr = addr + I386OBSD_UTHREAD_ESP_OFFSET;
CORE_ADDR sp = 0; CORE_ADDR sp = 0;
gdb_byte buf[4]; gdb_byte buf[4];
@ -285,10 +289,10 @@ i386obsd_collect_uthread (const struct regcache *regcache,
stored into the thread structure. */ stored into the thread structure. */
offset = i386obsd_uthread_reg_offset[I386_EIP_REGNUM] + 4; offset = i386obsd_uthread_reg_offset[I386_EIP_REGNUM] + 4;
regcache_raw_collect (regcache, I386_ESP_REGNUM, buf); regcache_raw_collect (regcache, I386_ESP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 4) - offset; sp = extract_unsigned_integer (buf, 4, byte_order) - offset;
/* Store the stack pointer. */ /* Store the stack pointer. */
write_memory_unsigned_integer (sp_addr, 4, sp); write_memory_unsigned_integer (sp_addr, 4, byte_order, sp);
/* The stack pointer was (potentially) modified. Make sure we /* The stack pointer was (potentially) modified. Make sure we
build a proper stack frame. */ build a proper stack frame. */
@ -303,7 +307,7 @@ i386obsd_collect_uthread (const struct regcache *regcache,
/* Fetch stack pointer from thread structure (if we didn't /* Fetch stack pointer from thread structure (if we didn't
calculate it already). */ calculate it already). */
if (sp == 0) if (sp == 0)
sp = read_memory_unsigned_integer (sp_addr, 4); sp = read_memory_unsigned_integer (sp_addr, 4, byte_order);
/* Write the register into the stack frame. */ /* Write the register into the stack frame. */
regcache_raw_collect (regcache, i, buf); regcache_raw_collect (regcache, i, buf);
@ -339,6 +343,8 @@ static int i386obsd_tf_reg_offset[] =
static struct trad_frame_cache * static struct trad_frame_cache *
i386obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache) i386obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct trad_frame_cache *cache; struct trad_frame_cache *cache;
CORE_ADDR func, sp, addr; CORE_ADDR func, sp, addr;
ULONGEST cs; ULONGEST cs;
@ -366,7 +372,7 @@ i386obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
/* Read %cs from trap frame. */ /* Read %cs from trap frame. */
addr += i386obsd_tf_reg_offset[I386_CS_REGNUM]; addr += i386obsd_tf_reg_offset[I386_CS_REGNUM];
cs = read_memory_unsigned_integer (addr, 4); cs = read_memory_unsigned_integer (addr, 4, byte_order);
if ((cs & I386_SEL_RPL) == I386_SEL_UPL) if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
{ {
/* Trap from user space; terminate backtrace. */ /* Trap from user space; terminate backtrace. */

View file

@ -389,7 +389,9 @@ static int fsave_offset[] =
void void
i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave) i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const gdb_byte *regs = fsave; const gdb_byte *regs = fsave;
int i; int i;
@ -429,7 +431,7 @@ i387_supply_fsave (struct regcache *regcache, int regnum, const void *fsave)
{ {
gdb_byte buf[4]; gdb_byte buf[4];
store_unsigned_integer (buf, 4, 0x1f80); store_unsigned_integer (buf, 4, byte_order, 0x1f80);
regcache_raw_supply (regcache, I387_MXCSR_REGNUM (tdep), buf); regcache_raw_supply (regcache, I387_MXCSR_REGNUM (tdep), buf);
} }
} }

View file

@ -50,14 +50,16 @@ ia64_linux_pc_in_sigtramp (CORE_ADDR pc)
sigcontext structure. */ sigcontext structure. */
static CORE_ADDR static CORE_ADDR
ia64_linux_sigcontext_register_address (CORE_ADDR sp, int regno) ia64_linux_sigcontext_register_address (struct gdbarch *gdbarch,
CORE_ADDR sp, int regno)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
char buf[8]; char buf[8];
CORE_ADDR sigcontext_addr = 0; CORE_ADDR sigcontext_addr = 0;
/* The address of the sigcontext area is found at offset 16 in the sigframe. */ /* The address of the sigcontext area is found at offset 16 in the sigframe. */
read_memory (sp + 16, buf, 8); read_memory (sp + 16, buf, 8);
sigcontext_addr = extract_unsigned_integer (buf, 8); sigcontext_addr = extract_unsigned_integer (buf, 8, byte_order);
if (IA64_GR0_REGNUM <= regno && regno <= IA64_GR31_REGNUM) if (IA64_GR0_REGNUM <= regno && regno <= IA64_GR31_REGNUM)
return sigcontext_addr + 200 + 8 * (regno - IA64_GR0_REGNUM); return sigcontext_addr + 200 + 8 * (regno - IA64_GR0_REGNUM);

View file

@ -123,7 +123,8 @@ static gdbarch_register_type_ftype ia64_register_type;
static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc; static gdbarch_breakpoint_from_pc_ftype ia64_breakpoint_from_pc;
static gdbarch_skip_prologue_ftype ia64_skip_prologue; static gdbarch_skip_prologue_ftype ia64_skip_prologue;
static struct type *is_float_or_hfa_type (struct type *t); static struct type *is_float_or_hfa_type (struct type *t);
static CORE_ADDR ia64_find_global_pointer (CORE_ADDR faddr); static CORE_ADDR ia64_find_global_pointer (struct gdbarch *gdbarch,
CORE_ADDR faddr);
#define NUM_IA64_RAW_REGS 462 #define NUM_IA64_RAW_REGS 462
@ -824,6 +825,8 @@ static void
ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, gdb_byte *buf) int regnum, gdb_byte *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (regnum >= V32_REGNUM && regnum <= V127_REGNUM) if (regnum >= V32_REGNUM && regnum <= V127_REGNUM)
{ {
#ifdef HAVE_LIBUNWIND_IA64_H #ifdef HAVE_LIBUNWIND_IA64_H
@ -849,11 +852,13 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
if ((cfm & 0x7f) > regnum - V32_REGNUM) if ((cfm & 0x7f) > regnum - V32_REGNUM)
{ {
ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM)); ULONGEST reg_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
reg = read_memory_integer ((CORE_ADDR)reg_addr, 8); reg = read_memory_integer ((CORE_ADDR)reg_addr, 8, byte_order);
store_unsigned_integer (buf, register_size (gdbarch, regnum), reg); store_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order, reg);
} }
else else
store_unsigned_integer (buf, register_size (gdbarch, regnum), 0); store_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order, 0);
} }
} }
else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM) else if (IA64_NAT0_REGNUM <= regnum && regnum <= IA64_NAT31_REGNUM)
@ -862,7 +867,8 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
ULONGEST unat; ULONGEST unat;
regcache_cooked_read_unsigned (regcache, IA64_UNAT_REGNUM, &unat); regcache_cooked_read_unsigned (regcache, IA64_UNAT_REGNUM, &unat);
unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0; unatN_val = (unat & (1LL << (regnum - IA64_NAT0_REGNUM))) != 0;
store_unsigned_integer (buf, register_size (gdbarch, regnum), unatN_val); store_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order, unatN_val);
} }
else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM) else if (IA64_NAT32_REGNUM <= regnum && regnum <= IA64_NAT127_REGNUM)
{ {
@ -892,12 +898,13 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
if (nat_addr >= bsp) if (nat_addr >= bsp)
regcache_cooked_read_unsigned (regcache, IA64_RNAT_REGNUM, &nat_collection); regcache_cooked_read_unsigned (regcache, IA64_RNAT_REGNUM, &nat_collection);
else else
nat_collection = read_memory_integer (nat_addr, 8); nat_collection = read_memory_integer (nat_addr, 8, byte_order);
nat_bit = (gr_addr >> 3) & 0x3f; nat_bit = (gr_addr >> 3) & 0x3f;
natN_val = (nat_collection >> nat_bit) & 1; natN_val = (nat_collection >> nat_bit) & 1;
} }
store_unsigned_integer (buf, register_size (gdbarch, regnum), natN_val); store_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order, natN_val);
} }
else if (regnum == VBOF_REGNUM) else if (regnum == VBOF_REGNUM)
{ {
@ -912,7 +919,8 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
/* The bsp points at the end of the register frame so we /* The bsp points at the end of the register frame so we
subtract the size of frame from it to get beginning of frame. */ subtract the size of frame from it to get beginning of frame. */
vbsp = rse_address_add (bsp, -(cfm & 0x7f)); vbsp = rse_address_add (bsp, -(cfm & 0x7f));
store_unsigned_integer (buf, register_size (gdbarch, regnum), vbsp); store_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order, vbsp);
} }
else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM) else if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
{ {
@ -934,7 +942,8 @@ ia64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
+ ((regnum - VP16_REGNUM) + rrb_pr) % 48; + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
} }
prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0; prN_val = (pr & (1LL << (regnum - VP0_REGNUM))) != 0;
store_unsigned_integer (buf, register_size (gdbarch, regnum), prN_val); store_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order, prN_val);
} }
else else
memset (buf, 0, register_size (gdbarch, regnum)); memset (buf, 0, register_size (gdbarch, regnum));
@ -944,6 +953,8 @@ static void
ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf) int regnum, const gdb_byte *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (regnum >= V32_REGNUM && regnum <= V127_REGNUM) if (regnum >= V32_REGNUM && regnum <= V127_REGNUM)
{ {
ULONGEST bsp; ULONGEST bsp;
@ -964,7 +975,8 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
{ {
ULONGEST unatN_val, unat, unatN_mask; ULONGEST unatN_val, unat, unatN_mask;
regcache_cooked_read_unsigned (regcache, IA64_UNAT_REGNUM, &unat); regcache_cooked_read_unsigned (regcache, IA64_UNAT_REGNUM, &unat);
unatN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum)); unatN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order);
unatN_mask = (1LL << (regnum - IA64_NAT0_REGNUM)); unatN_mask = (1LL << (regnum - IA64_NAT0_REGNUM));
if (unatN_val == 0) if (unatN_val == 0)
unat &= ~unatN_mask; unat &= ~unatN_mask;
@ -988,7 +1000,8 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
if ((cfm & 0x7f) > regnum - V32_REGNUM) if ((cfm & 0x7f) > regnum - V32_REGNUM)
gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM)); gr_addr = rse_address_add (bsp, (regnum - V32_REGNUM));
natN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum)); natN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order);
if (gr_addr != 0 && (natN_val == 0 || natN_val == 1)) if (gr_addr != 0 && (natN_val == 0 || natN_val == 1))
{ {
@ -1012,12 +1025,13 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else else
{ {
char nat_buf[8]; char nat_buf[8];
nat_collection = read_memory_integer (nat_addr, 8); nat_collection = read_memory_integer (nat_addr, 8, byte_order);
if (natN_val) if (natN_val)
nat_collection |= natN_mask; nat_collection |= natN_mask;
else else
nat_collection &= ~natN_mask; nat_collection &= ~natN_mask;
store_unsigned_integer (nat_buf, register_size (gdbarch, regnum), nat_collection); store_unsigned_integer (nat_buf, register_size (gdbarch, regnum),
byte_order, nat_collection);
write_memory (nat_addr, nat_buf, 8); write_memory (nat_addr, nat_buf, 8);
} }
} }
@ -1042,7 +1056,8 @@ ia64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
regnum = VP16_REGNUM regnum = VP16_REGNUM
+ ((regnum - VP16_REGNUM) + rrb_pr) % 48; + ((regnum - VP16_REGNUM) + rrb_pr) % 48;
} }
prN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum)); prN_val = extract_unsigned_integer (buf, register_size (gdbarch, regnum),
byte_order);
prN_mask = (1LL << (regnum - VP0_REGNUM)); prN_mask = (1LL << (regnum - VP0_REGNUM));
if (prN_val == 0) if (prN_val == 0)
pr &= ~prN_mask; pr &= ~prN_mask;
@ -1365,8 +1380,10 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
this'll be wrong. FIXME */ this'll be wrong. FIXME */
if (this_frame) if (this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
get_frame_register (this_frame, sp_regnum, buf); get_frame_register (this_frame, sp_regnum, buf);
saved_sp = extract_unsigned_integer (buf, 8); saved_sp = extract_unsigned_integer (buf, 8, byte_order);
} }
spill_addr = saved_sp spill_addr = saved_sp
+ (rM == 12 ? 0 : mem_stack_frame_size) + (rM == 12 ? 0 : mem_stack_frame_size)
@ -1571,6 +1588,9 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
if (!frameless && this_frame) if (!frameless && this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Extract the size of the rotating portion of the stack /* Extract the size of the rotating portion of the stack
frame and the register rename base from the current frame and the register rename base from the current
frame marker. */ frame marker. */
@ -1604,12 +1624,13 @@ examine_prologue (CORE_ADDR pc, CORE_ADDR lim_pc,
cfm = 0; cfm = 0;
if (cache->saved_regs[IA64_CFM_REGNUM] != 0) if (cache->saved_regs[IA64_CFM_REGNUM] != 0)
{ {
cfm = read_memory_integer (cache->saved_regs[IA64_CFM_REGNUM], 8); cfm = read_memory_integer (cache->saved_regs[IA64_CFM_REGNUM],
8, byte_order);
} }
else if (cfm_reg != 0) else if (cfm_reg != 0)
{ {
get_frame_register (this_frame, cfm_reg, buf); get_frame_register (this_frame, cfm_reg, buf);
cfm = extract_unsigned_integer (buf, 8); cfm = extract_unsigned_integer (buf, 8, byte_order);
} }
cache->prev_cfm = cfm; cache->prev_cfm = cfm;
@ -1674,6 +1695,8 @@ ia64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
static struct ia64_frame_cache * static struct ia64_frame_cache *
ia64_frame_cache (struct frame_info *this_frame, void **this_cache) ia64_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct ia64_frame_cache *cache; struct ia64_frame_cache *cache;
char buf[8]; char buf[8];
CORE_ADDR cfm, sof, sol, bsp, psr; CORE_ADDR cfm, sof, sol, bsp, psr;
@ -1686,19 +1709,19 @@ ia64_frame_cache (struct frame_info *this_frame, void **this_cache)
*this_cache = cache; *this_cache = cache;
get_frame_register (this_frame, sp_regnum, buf); get_frame_register (this_frame, sp_regnum, buf);
cache->saved_sp = extract_unsigned_integer (buf, 8); cache->saved_sp = extract_unsigned_integer (buf, 8, byte_order);
/* We always want the bsp to point to the end of frame. /* We always want the bsp to point to the end of frame.
This way, we can always get the beginning of frame (bof) This way, we can always get the beginning of frame (bof)
by subtracting frame size. */ by subtracting frame size. */
get_frame_register (this_frame, IA64_BSP_REGNUM, buf); get_frame_register (this_frame, IA64_BSP_REGNUM, buf);
cache->bsp = extract_unsigned_integer (buf, 8); cache->bsp = extract_unsigned_integer (buf, 8, byte_order);
get_frame_register (this_frame, IA64_PSR_REGNUM, buf); get_frame_register (this_frame, IA64_PSR_REGNUM, buf);
psr = extract_unsigned_integer (buf, 8); psr = extract_unsigned_integer (buf, 8, byte_order);
get_frame_register (this_frame, IA64_CFM_REGNUM, buf); get_frame_register (this_frame, IA64_CFM_REGNUM, buf);
cfm = extract_unsigned_integer (buf, 8); cfm = extract_unsigned_integer (buf, 8, byte_order);
cache->sof = (cfm & 0x7f); cache->sof = (cfm & 0x7f);
cache->sol = (cfm >> 7) & 0x7f; cache->sol = (cfm >> 7) & 0x7f;
@ -1743,6 +1766,7 @@ ia64_frame_prev_register (struct frame_info *this_frame, void **this_cache,
int regnum) int regnum)
{ {
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);
struct ia64_frame_cache *cache = ia64_frame_cache (this_frame, this_cache); struct ia64_frame_cache *cache = ia64_frame_cache (this_frame, this_cache);
char buf[8]; char buf[8];
@ -1768,7 +1792,8 @@ ia64_frame_prev_register (struct frame_info *this_frame, void **this_cache,
that frame by adding the size of output: that frame by adding the size of output:
(sof (size of frame) - sol (size of locals)). */ (sof (size of frame) - sol (size of locals)). */
val = ia64_frame_prev_register (this_frame, this_cache, IA64_CFM_REGNUM); val = ia64_frame_prev_register (this_frame, this_cache, IA64_CFM_REGNUM);
prev_cfm = extract_unsigned_integer (value_contents_all (val), 8); prev_cfm = extract_unsigned_integer (value_contents_all (val),
8, byte_order);
bsp = rse_address_add (cache->bsp, -(cache->sof)); bsp = rse_address_add (cache->bsp, -(cache->sof));
prev_bsp = prev_bsp =
rse_address_add (bsp, (prev_cfm & 0x7f) - ((prev_cfm >> 7) & 0x7f)); rse_address_add (bsp, (prev_cfm & 0x7f) - ((prev_cfm >> 7) & 0x7f));
@ -1854,14 +1879,14 @@ ia64_frame_prev_register (struct frame_info *this_frame, void **this_cache,
the nat collection from rnat. Otherwise, we fetch the nat the nat collection from rnat. Otherwise, we fetch the nat
collection from the computed address. */ collection from the computed address. */
get_frame_register (this_frame, IA64_BSP_REGNUM, buf); get_frame_register (this_frame, IA64_BSP_REGNUM, buf);
bsp = extract_unsigned_integer (buf, 8); bsp = extract_unsigned_integer (buf, 8, byte_order);
if (nat_addr >= bsp) if (nat_addr >= bsp)
{ {
get_frame_register (this_frame, IA64_RNAT_REGNUM, buf); get_frame_register (this_frame, IA64_RNAT_REGNUM, buf);
nat_collection = extract_unsigned_integer (buf, 8); nat_collection = extract_unsigned_integer (buf, 8, byte_order);
} }
else else
nat_collection = read_memory_integer (nat_addr, 8); nat_collection = read_memory_integer (nat_addr, 8, byte_order);
nat_bit = (gr_addr >> 3) & 0x3f; nat_bit = (gr_addr >> 3) & 0x3f;
natval = (nat_collection >> nat_bit) & 1; natval = (nat_collection >> nat_bit) & 1;
} }
@ -1877,12 +1902,12 @@ ia64_frame_prev_register (struct frame_info *this_frame, void **this_cache,
if (addr != 0) if (addr != 0)
{ {
read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM)); read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM));
pc = extract_unsigned_integer (buf, 8); pc = extract_unsigned_integer (buf, 8, byte_order);
} }
else if (cache->frameless) else if (cache->frameless)
{ {
get_frame_register (this_frame, IA64_BR0_REGNUM, buf); get_frame_register (this_frame, IA64_BR0_REGNUM, buf);
pc = extract_unsigned_integer (buf, 8); pc = extract_unsigned_integer (buf, 8, byte_order);
} }
pc &= ~0xf; pc &= ~0xf;
return frame_unwind_got_constant (this_frame, regnum, pc); return frame_unwind_got_constant (this_frame, regnum, pc);
@ -1900,17 +1925,17 @@ ia64_frame_prev_register (struct frame_info *this_frame, void **this_cache,
CORE_ADDR addr = cache->saved_regs[IA64_VRAP_REGNUM]; CORE_ADDR addr = cache->saved_regs[IA64_VRAP_REGNUM];
get_frame_register (this_frame, IA64_PSR_REGNUM, buf); get_frame_register (this_frame, IA64_PSR_REGNUM, buf);
psr = extract_unsigned_integer (buf, 8); psr = extract_unsigned_integer (buf, 8, byte_order);
if (addr != 0) if (addr != 0)
{ {
read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM)); read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM));
pc = extract_unsigned_integer (buf, 8); pc = extract_unsigned_integer (buf, 8, byte_order);
} }
else if (cache->frameless) else if (cache->frameless)
{ {
get_frame_register (this_frame, IA64_BR0_REGNUM, buf); get_frame_register (this_frame, IA64_BR0_REGNUM, buf);
pc = extract_unsigned_integer (buf, 8); pc = extract_unsigned_integer (buf, 8, byte_order);
} }
psr &= ~(3LL << 41); psr &= ~(3LL << 41);
slot_num = pc & 0x3LL; slot_num = pc & 0x3LL;
@ -1951,11 +1976,11 @@ ia64_frame_prev_register (struct frame_info *this_frame, void **this_cache,
reg_val = ia64_frame_prev_register (this_frame, this_cache, reg_val = ia64_frame_prev_register (this_frame, this_cache,
IA64_CFM_REGNUM); IA64_CFM_REGNUM);
prev_cfm = extract_unsigned_integer (value_contents_all (reg_val), prev_cfm = extract_unsigned_integer (value_contents_all (reg_val),
8); 8, byte_order);
reg_val = ia64_frame_prev_register (this_frame, this_cache, reg_val = ia64_frame_prev_register (this_frame, this_cache,
IA64_BSP_REGNUM); IA64_BSP_REGNUM);
prev_bsp = extract_unsigned_integer (value_contents_all (reg_val), prev_bsp = extract_unsigned_integer (value_contents_all (reg_val),
8); 8, byte_order);
prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f)); prev_bof = rse_address_add (prev_bsp, -(prev_cfm & 0x7f));
addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM)); addr = rse_address_add (prev_bof, (regnum - IA64_GR32_REGNUM));
@ -2006,47 +2031,50 @@ static void
ia64_sigtramp_frame_init_saved_regs (struct frame_info *this_frame, ia64_sigtramp_frame_init_saved_regs (struct frame_info *this_frame,
struct ia64_frame_cache *cache) struct ia64_frame_cache *cache)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (tdep->sigcontext_register_address) if (tdep->sigcontext_register_address)
{ {
int regno; int regno;
cache->saved_regs[IA64_VRAP_REGNUM] = cache->saved_regs[IA64_VRAP_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_IP_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_IP_REGNUM);
cache->saved_regs[IA64_CFM_REGNUM] = cache->saved_regs[IA64_CFM_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_CFM_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_CFM_REGNUM);
cache->saved_regs[IA64_PSR_REGNUM] = cache->saved_regs[IA64_PSR_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_PSR_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_PSR_REGNUM);
cache->saved_regs[IA64_BSP_REGNUM] = cache->saved_regs[IA64_BSP_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_BSP_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_BSP_REGNUM);
cache->saved_regs[IA64_RNAT_REGNUM] = cache->saved_regs[IA64_RNAT_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_RNAT_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_RNAT_REGNUM);
cache->saved_regs[IA64_CCV_REGNUM] = cache->saved_regs[IA64_CCV_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_CCV_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_CCV_REGNUM);
cache->saved_regs[IA64_UNAT_REGNUM] = cache->saved_regs[IA64_UNAT_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_UNAT_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_UNAT_REGNUM);
cache->saved_regs[IA64_FPSR_REGNUM] = cache->saved_regs[IA64_FPSR_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_FPSR_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_FPSR_REGNUM);
cache->saved_regs[IA64_PFS_REGNUM] = cache->saved_regs[IA64_PFS_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_PFS_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_PFS_REGNUM);
cache->saved_regs[IA64_LC_REGNUM] = cache->saved_regs[IA64_LC_REGNUM] =
tdep->sigcontext_register_address (cache->base, IA64_LC_REGNUM); tdep->sigcontext_register_address (gdbarch, cache->base, IA64_LC_REGNUM);
for (regno = IA64_GR1_REGNUM; regno <= IA64_GR31_REGNUM; regno++) for (regno = IA64_GR1_REGNUM; regno <= IA64_GR31_REGNUM; regno++)
cache->saved_regs[regno] = cache->saved_regs[regno] =
tdep->sigcontext_register_address (cache->base, regno); tdep->sigcontext_register_address (gdbarch, cache->base, regno);
for (regno = IA64_BR0_REGNUM; regno <= IA64_BR7_REGNUM; regno++) for (regno = IA64_BR0_REGNUM; regno <= IA64_BR7_REGNUM; regno++)
cache->saved_regs[regno] = cache->saved_regs[regno] =
tdep->sigcontext_register_address (cache->base, regno); tdep->sigcontext_register_address (gdbarch, cache->base, regno);
for (regno = IA64_FR2_REGNUM; regno <= IA64_FR31_REGNUM; regno++) for (regno = IA64_FR2_REGNUM; regno <= IA64_FR31_REGNUM; regno++)
cache->saved_regs[regno] = cache->saved_regs[regno] =
tdep->sigcontext_register_address (cache->base, regno); tdep->sigcontext_register_address (gdbarch, cache->base, regno);
} }
} }
static struct ia64_frame_cache * static struct ia64_frame_cache *
ia64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache) ia64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct ia64_frame_cache *cache; struct ia64_frame_cache *cache;
CORE_ADDR addr; CORE_ADDR addr;
char buf[8]; char buf[8];
@ -2060,13 +2088,13 @@ ia64_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
get_frame_register (this_frame, sp_regnum, buf); get_frame_register (this_frame, sp_regnum, buf);
/* Note that frame size is hard-coded below. We cannot calculate it /* Note that frame size is hard-coded below. We cannot calculate it
via prologue examination. */ via prologue examination. */
cache->base = extract_unsigned_integer (buf, 8) + 16; cache->base = extract_unsigned_integer (buf, 8, byte_order) + 16;
get_frame_register (this_frame, IA64_BSP_REGNUM, buf); get_frame_register (this_frame, IA64_BSP_REGNUM, buf);
cache->bsp = extract_unsigned_integer (buf, 8); cache->bsp = extract_unsigned_integer (buf, 8, byte_order);
get_frame_register (this_frame, IA64_CFM_REGNUM, buf); get_frame_register (this_frame, IA64_CFM_REGNUM, buf);
cache->cfm = extract_unsigned_integer (buf, 8); cache->cfm = extract_unsigned_integer (buf, 8, byte_order);
cache->sof = cache->cfm & 0x7f; cache->sof = cache->cfm & 0x7f;
ia64_sigtramp_frame_init_saved_regs (this_frame, cache); ia64_sigtramp_frame_init_saved_regs (this_frame, cache);
@ -2102,6 +2130,7 @@ ia64_sigtramp_frame_prev_register (struct frame_info *this_frame,
char buf[MAX_REGISTER_SIZE]; char buf[MAX_REGISTER_SIZE];
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);
struct ia64_frame_cache *cache = struct ia64_frame_cache *cache =
ia64_sigtramp_frame_cache (this_frame, this_cache); ia64_sigtramp_frame_cache (this_frame, this_cache);
@ -2118,7 +2147,7 @@ ia64_sigtramp_frame_prev_register (struct frame_info *this_frame,
if (addr != 0) if (addr != 0)
{ {
read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM)); read_memory (addr, buf, register_size (gdbarch, IA64_IP_REGNUM));
pc = extract_unsigned_integer (buf, 8); pc = extract_unsigned_integer (buf, 8, byte_order);
} }
pc &= ~0xf; pc &= ~0xf;
return frame_unwind_got_constant (this_frame, regnum, pc); return frame_unwind_got_constant (this_frame, regnum, pc);
@ -2301,6 +2330,7 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
unw_word_t bsp, sof, sol, cfm, psr, ip; unw_word_t bsp, sof, sol, cfm, psr, ip;
struct frame_info *this_frame = arg; struct frame_info *this_frame = arg;
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);
long new_sof, old_sof; long new_sof, old_sof;
char buf[MAX_REGISTER_SIZE]; char buf[MAX_REGISTER_SIZE];
@ -2313,9 +2343,9 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
/* Libunwind expects to see the pc value which means the slot number /* Libunwind expects to see the pc value which means the slot number
from the psr must be merged with the ip word address. */ from the psr must be merged with the ip word address. */
get_frame_register (this_frame, IA64_IP_REGNUM, buf); get_frame_register (this_frame, IA64_IP_REGNUM, buf);
ip = extract_unsigned_integer (buf, 8); ip = extract_unsigned_integer (buf, 8, byte_order);
get_frame_register (this_frame, IA64_PSR_REGNUM, buf); get_frame_register (this_frame, IA64_PSR_REGNUM, buf);
psr = extract_unsigned_integer (buf, 8); psr = extract_unsigned_integer (buf, 8, byte_order);
*val = ip | ((psr >> 41) & 0x3); *val = ip | ((psr >> 41) & 0x3);
break; break;
@ -2324,9 +2354,9 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
frame so we must account for the fact that ptrace() will return a value frame so we must account for the fact that ptrace() will return a value
for bsp that points *after* the current register frame. */ for bsp that points *after* the current register frame. */
get_frame_register (this_frame, IA64_BSP_REGNUM, buf); get_frame_register (this_frame, IA64_BSP_REGNUM, buf);
bsp = extract_unsigned_integer (buf, 8); bsp = extract_unsigned_integer (buf, 8, byte_order);
get_frame_register (this_frame, IA64_CFM_REGNUM, buf); get_frame_register (this_frame, IA64_CFM_REGNUM, buf);
cfm = extract_unsigned_integer (buf, 8); cfm = extract_unsigned_integer (buf, 8, byte_order);
sof = (cfm & 0x7f); sof = (cfm & 0x7f);
*val = ia64_rse_skip_regs (bsp, -sof); *val = ia64_rse_skip_regs (bsp, -sof);
break; break;
@ -2335,13 +2365,13 @@ ia64_access_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *val,
/* Libunwind wants bspstore to be after the current register frame. /* Libunwind wants bspstore to be after the current register frame.
This is what ptrace() and gdb treats as the regular bsp value. */ This is what ptrace() and gdb treats as the regular bsp value. */
get_frame_register (this_frame, IA64_BSP_REGNUM, buf); get_frame_register (this_frame, IA64_BSP_REGNUM, buf);
*val = extract_unsigned_integer (buf, 8); *val = extract_unsigned_integer (buf, 8, byte_order);
break; break;
default: default:
/* For all other registers, just unwind the value directly. */ /* For all other registers, just unwind the value directly. */
get_frame_register (this_frame, regnum, buf); get_frame_register (this_frame, regnum, buf);
*val = extract_unsigned_integer (buf, 8); *val = extract_unsigned_integer (buf, 8, byte_order);
break; break;
} }
@ -2379,6 +2409,7 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *va
unw_word_t bsp, sof, sol, cfm, psr, ip; unw_word_t bsp, sof, sol, cfm, psr, ip;
struct regcache *regcache = arg; struct regcache *regcache = arg;
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
long new_sof, old_sof; long new_sof, old_sof;
char buf[MAX_REGISTER_SIZE]; char buf[MAX_REGISTER_SIZE];
@ -2391,9 +2422,9 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *va
/* Libunwind expects to see the pc value which means the slot number /* Libunwind expects to see the pc value which means the slot number
from the psr must be merged with the ip word address. */ from the psr must be merged with the ip word address. */
regcache_cooked_read (regcache, IA64_IP_REGNUM, buf); regcache_cooked_read (regcache, IA64_IP_REGNUM, buf);
ip = extract_unsigned_integer (buf, 8); ip = extract_unsigned_integer (buf, 8, byte_order);
regcache_cooked_read (regcache, IA64_PSR_REGNUM, buf); regcache_cooked_read (regcache, IA64_PSR_REGNUM, buf);
psr = extract_unsigned_integer (buf, 8); psr = extract_unsigned_integer (buf, 8, byte_order);
*val = ip | ((psr >> 41) & 0x3); *val = ip | ((psr >> 41) & 0x3);
break; break;
@ -2402,9 +2433,9 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *va
frame so we must account for the fact that ptrace() will return a value frame so we must account for the fact that ptrace() will return a value
for bsp that points *after* the current register frame. */ for bsp that points *after* the current register frame. */
regcache_cooked_read (regcache, IA64_BSP_REGNUM, buf); regcache_cooked_read (regcache, IA64_BSP_REGNUM, buf);
bsp = extract_unsigned_integer (buf, 8); bsp = extract_unsigned_integer (buf, 8, byte_order);
regcache_cooked_read (regcache, IA64_CFM_REGNUM, buf); regcache_cooked_read (regcache, IA64_CFM_REGNUM, buf);
cfm = extract_unsigned_integer (buf, 8); cfm = extract_unsigned_integer (buf, 8, byte_order);
sof = (cfm & 0x7f); sof = (cfm & 0x7f);
*val = ia64_rse_skip_regs (bsp, -sof); *val = ia64_rse_skip_regs (bsp, -sof);
break; break;
@ -2413,13 +2444,13 @@ ia64_access_rse_reg (unw_addr_space_t as, unw_regnum_t uw_regnum, unw_word_t *va
/* Libunwind wants bspstore to be after the current register frame. /* Libunwind wants bspstore to be after the current register frame.
This is what ptrace() and gdb treats as the regular bsp value. */ This is what ptrace() and gdb treats as the regular bsp value. */
regcache_cooked_read (regcache, IA64_BSP_REGNUM, buf); regcache_cooked_read (regcache, IA64_BSP_REGNUM, buf);
*val = extract_unsigned_integer (buf, 8); *val = extract_unsigned_integer (buf, 8, byte_order);
break; break;
default: default:
/* For all other registers, just unwind the value directly. */ /* For all other registers, just unwind the value directly. */
regcache_cooked_read (regcache, regnum, buf); regcache_cooked_read (regcache, regnum, buf);
*val = extract_unsigned_integer (buf, 8); *val = extract_unsigned_integer (buf, 8, byte_order);
break; break;
} }
@ -2606,7 +2637,7 @@ ia64_find_unwind_table (struct objfile *objfile, unw_word_t ip,
dip->start_ip = p_text->p_vaddr + load_base; dip->start_ip = p_text->p_vaddr + load_base;
dip->end_ip = dip->start_ip + p_text->p_memsz; dip->end_ip = dip->start_ip + p_text->p_memsz;
dip->gp = ia64_find_global_pointer (ip); dip->gp = ia64_find_global_pointer (get_objfile_arch (objfile), ip);
dip->format = UNW_INFO_FORMAT_REMOTE_TABLE; dip->format = UNW_INFO_FORMAT_REMOTE_TABLE;
dip->u.rti.name_ptr = (unw_word_t) bfd_get_filename (bfd); dip->u.rti.name_ptr = (unw_word_t) bfd_get_filename (bfd);
dip->u.rti.segbase = segbase; dip->u.rti.segbase = segbase;
@ -2732,6 +2763,7 @@ ia64_libunwind_frame_this_id (struct frame_info *this_frame, void **this_cache,
struct frame_id *this_id) struct frame_id *this_id)
{ {
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);
struct frame_id id; struct frame_id id;
char buf[8]; char buf[8];
CORE_ADDR bsp; CORE_ADDR bsp;
@ -2747,7 +2779,7 @@ ia64_libunwind_frame_this_id (struct frame_info *this_frame, void **this_cache,
/* We must add the bsp as the special address for frame comparison /* We must add the bsp as the special address for frame comparison
purposes. */ purposes. */
get_frame_register (this_frame, IA64_BSP_REGNUM, buf); get_frame_register (this_frame, IA64_BSP_REGNUM, buf);
bsp = extract_unsigned_integer (buf, 8); bsp = extract_unsigned_integer (buf, 8, byte_order);
(*this_id) = frame_id_build_special (id.stack_addr, id.code_addr, bsp); (*this_id) = frame_id_build_special (id.stack_addr, id.code_addr, bsp);
@ -2766,6 +2798,7 @@ ia64_libunwind_frame_prev_register (struct frame_info *this_frame,
{ {
int reg = regnum; int reg = regnum;
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);
struct value *val; struct value *val;
if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM) if (VP0_REGNUM <= regnum && regnum <= VP63_REGNUM)
@ -2789,7 +2822,7 @@ ia64_libunwind_frame_prev_register (struct frame_info *this_frame,
/* Fetch predicate register rename base from current frame /* Fetch predicate register rename base from current frame
marker for this frame. */ marker for this frame. */
get_frame_register (this_frame, IA64_CFM_REGNUM, buf); get_frame_register (this_frame, IA64_CFM_REGNUM, buf);
cfm = extract_unsigned_integer (buf, 8); cfm = extract_unsigned_integer (buf, 8, byte_order);
rrb_pr = (cfm >> 32) & 0x3f; rrb_pr = (cfm >> 32) & 0x3f;
/* Adjust the register number to account for register rotation. */ /* Adjust the register number to account for register rotation. */
@ -2819,10 +2852,12 @@ ia64_libunwind_frame_prev_register (struct frame_info *this_frame,
register will be if we pop the frame back which is why we might register will be if we pop the frame back which is why we might
have been called. We know that libunwind will pass us back the have been called. We know that libunwind will pass us back the
beginning of the current frame so we should just add sof to it. */ beginning of the current frame so we should just add sof to it. */
prev_bsp = extract_unsigned_integer (value_contents_all (val), 8); prev_bsp = extract_unsigned_integer (value_contents_all (val),
8, byte_order);
cfm_val = libunwind_frame_prev_register (this_frame, this_cache, cfm_val = libunwind_frame_prev_register (this_frame, this_cache,
IA64_CFM_REGNUM); IA64_CFM_REGNUM);
prev_cfm = extract_unsigned_integer (value_contents_all (cfm_val), 8); prev_cfm = extract_unsigned_integer (value_contents_all (cfm_val),
8, byte_order);
prev_bsp = rse_address_add (prev_bsp, (prev_cfm & 0x7f)); prev_bsp = rse_address_add (prev_bsp, (prev_cfm & 0x7f));
return frame_unwind_got_constant (this_frame, regnum, prev_bsp); return frame_unwind_got_constant (this_frame, regnum, prev_bsp);
@ -2859,6 +2894,7 @@ ia64_libunwind_sigtramp_frame_this_id (struct frame_info *this_frame,
struct frame_id *this_id) struct frame_id *this_id)
{ {
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);
char buf[8]; char buf[8];
CORE_ADDR bsp; CORE_ADDR bsp;
struct frame_id id; struct frame_id id;
@ -2874,7 +2910,7 @@ ia64_libunwind_sigtramp_frame_this_id (struct frame_info *this_frame,
/* We must add the bsp as the special address for frame comparison /* We must add the bsp as the special address for frame comparison
purposes. */ purposes. */
get_frame_register (this_frame, IA64_BSP_REGNUM, buf); get_frame_register (this_frame, IA64_BSP_REGNUM, buf);
bsp = extract_unsigned_integer (buf, 8); bsp = extract_unsigned_integer (buf, 8, byte_order);
/* For a sigtramp frame, we don't make the check for previous ip being 0. */ /* For a sigtramp frame, we don't make the check for previous ip being 0. */
(*this_id) = frame_id_build_special (id.stack_addr, id.code_addr, bsp); (*this_id) = frame_id_build_special (id.stack_addr, id.code_addr, bsp);
@ -2892,6 +2928,8 @@ static struct value *
ia64_libunwind_sigtramp_frame_prev_register (struct frame_info *this_frame, ia64_libunwind_sigtramp_frame_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum) void **this_cache, int regnum)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct value *prev_ip_val; struct value *prev_ip_val;
CORE_ADDR prev_ip; CORE_ADDR prev_ip;
@ -2899,7 +2937,8 @@ ia64_libunwind_sigtramp_frame_prev_register (struct frame_info *this_frame,
method of getting previous registers. */ method of getting previous registers. */
prev_ip_val = libunwind_frame_prev_register (this_frame, this_cache, prev_ip_val = libunwind_frame_prev_register (this_frame, this_cache,
IA64_IP_REGNUM); IA64_IP_REGNUM);
prev_ip = extract_unsigned_integer (value_contents_all (prev_ip_val), 8); prev_ip = extract_unsigned_integer (value_contents_all (prev_ip_val),
8, byte_order);
if (prev_ip == 0) if (prev_ip == 0)
{ {
@ -3221,8 +3260,9 @@ slot_alignment_is_next_even (struct type *t)
d_un.d_ptr value is the global pointer. */ d_un.d_ptr value is the global pointer. */
static CORE_ADDR static CORE_ADDR
ia64_find_global_pointer (CORE_ADDR faddr) ia64_find_global_pointer (struct gdbarch *gdbarch, CORE_ADDR faddr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct obj_section *faddr_sect; struct obj_section *faddr_sect;
faddr_sect = find_pc_section (faddr); faddr_sect = find_pc_section (faddr);
@ -3252,7 +3292,7 @@ ia64_find_global_pointer (CORE_ADDR faddr)
status = target_read_memory (addr, buf, sizeof (buf)); status = target_read_memory (addr, buf, sizeof (buf));
if (status != 0) if (status != 0)
break; break;
tag = extract_signed_integer (buf, sizeof (buf)); tag = extract_signed_integer (buf, sizeof (buf), byte_order);
if (tag == DT_PLTGOT) if (tag == DT_PLTGOT)
{ {
@ -3261,7 +3301,8 @@ ia64_find_global_pointer (CORE_ADDR faddr)
status = target_read_memory (addr + 8, buf, sizeof (buf)); status = target_read_memory (addr + 8, buf, sizeof (buf));
if (status != 0) if (status != 0)
break; break;
global_pointer = extract_unsigned_integer (buf, sizeof (buf)); global_pointer = extract_unsigned_integer (buf, sizeof (buf),
byte_order);
/* The payoff... */ /* The payoff... */
return global_pointer; return global_pointer;
@ -3281,8 +3322,9 @@ ia64_find_global_pointer (CORE_ADDR faddr)
corresponding (canonical) function descriptor. Return 0 if corresponding (canonical) function descriptor. Return 0 if
not found. */ not found. */
static CORE_ADDR static CORE_ADDR
find_extant_func_descr (CORE_ADDR faddr) find_extant_func_descr (struct gdbarch *gdbarch, CORE_ADDR faddr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct obj_section *faddr_sect; struct obj_section *faddr_sect;
/* Return early if faddr is already a function descriptor. */ /* Return early if faddr is already a function descriptor. */
@ -3315,7 +3357,7 @@ find_extant_func_descr (CORE_ADDR faddr)
status = target_read_memory (addr, buf, sizeof (buf)); status = target_read_memory (addr, buf, sizeof (buf));
if (status != 0) if (status != 0)
break; break;
faddr2 = extract_signed_integer (buf, sizeof (buf)); faddr2 = extract_signed_integer (buf, sizeof (buf), byte_order);
if (faddr == faddr2) if (faddr == faddr2)
return addr; return addr;
@ -3334,9 +3376,11 @@ find_extant_func_descr (CORE_ADDR faddr)
static CORE_ADDR static CORE_ADDR
find_func_descr (struct regcache *regcache, CORE_ADDR faddr, CORE_ADDR *fdaptr) find_func_descr (struct regcache *regcache, CORE_ADDR faddr, CORE_ADDR *fdaptr)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR fdesc; CORE_ADDR fdesc;
fdesc = find_extant_func_descr (faddr); fdesc = find_extant_func_descr (gdbarch, faddr);
if (fdesc == 0) if (fdesc == 0)
{ {
@ -3346,14 +3390,14 @@ find_func_descr (struct regcache *regcache, CORE_ADDR faddr, CORE_ADDR *fdaptr)
fdesc = *fdaptr; fdesc = *fdaptr;
*fdaptr += 16; *fdaptr += 16;
global_pointer = ia64_find_global_pointer (faddr); global_pointer = ia64_find_global_pointer (gdbarch, faddr);
if (global_pointer == 0) if (global_pointer == 0)
regcache_cooked_read_unsigned (regcache, regcache_cooked_read_unsigned (regcache,
IA64_GR1_REGNUM, &global_pointer); IA64_GR1_REGNUM, &global_pointer);
store_unsigned_integer (buf, 8, faddr); store_unsigned_integer (buf, 8, byte_order, faddr);
store_unsigned_integer (buf + 8, 8, global_pointer); store_unsigned_integer (buf + 8, 8, byte_order, global_pointer);
write_memory (fdesc, buf, 16); write_memory (fdesc, buf, 16);
} }
@ -3368,13 +3412,14 @@ static CORE_ADDR
ia64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr, ia64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
struct target_ops *targ) struct target_ops *targ)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct obj_section *s; struct obj_section *s;
s = find_pc_section (addr); s = find_pc_section (addr);
/* check if ADDR points to a function descriptor. */ /* check if ADDR points to a function descriptor. */
if (s && strcmp (s->the_bfd_section->name, ".opd") == 0) if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
return read_memory_unsigned_integer (addr, 8); return read_memory_unsigned_integer (addr, 8, byte_order);
/* Normally, functions live inside a section that is executable. /* Normally, functions live inside a section that is executable.
So, if ADDR points to a non-executable section, then treat it So, if ADDR points to a non-executable section, then treat it
@ -3382,7 +3427,7 @@ ia64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
the target address itself points to a section that is executable. */ the target address itself points to a section that is executable. */
if (s && (s->the_bfd_section->flags & SEC_CODE) == 0) if (s && (s->the_bfd_section->flags & SEC_CODE) == 0)
{ {
CORE_ADDR pc = read_memory_unsigned_integer (addr, 8); CORE_ADDR pc = read_memory_unsigned_integer (addr, 8, byte_order);
struct obj_section *pc_section = find_pc_section (pc); struct obj_section *pc_section = find_pc_section (pc);
if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE)) if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
@ -3397,7 +3442,7 @@ ia64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
minsym = lookup_minimal_symbol_by_pc (addr); minsym = lookup_minimal_symbol_by_pc (addr);
if (minsym && is_vtable_name (SYMBOL_LINKAGE_NAME (minsym))) if (minsym && is_vtable_name (SYMBOL_LINKAGE_NAME (minsym)))
return read_memory_unsigned_integer (addr, 8); return read_memory_unsigned_integer (addr, 8, byte_order);
} }
return addr; return addr;
@ -3415,6 +3460,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int argno; int argno;
struct value *arg; struct value *arg;
struct type *type; struct type *type;
@ -3495,8 +3541,9 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
&& TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC) && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)
{ {
char val_buf[8]; char val_buf[8];
ULONGEST faddr = extract_unsigned_integer (value_contents (arg), 8); ULONGEST faddr = extract_unsigned_integer (value_contents (arg),
store_unsigned_integer (val_buf, 8, 8, byte_order);
store_unsigned_integer (val_buf, 8, byte_order,
find_func_descr (regcache, faddr, find_func_descr (regcache, faddr,
&funcdescaddr)); &funcdescaddr));
if (slotnum < rseslots) if (slotnum < rseslots)
@ -3556,7 +3603,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_unsigned (regcache, IA64_GR8_REGNUM, (ULONGEST)struct_addr); regcache_cooked_write_unsigned (regcache, IA64_GR8_REGNUM, (ULONGEST)struct_addr);
} }
global_pointer = ia64_find_global_pointer (func_addr); global_pointer = ia64_find_global_pointer (gdbarch, func_addr);
if (global_pointer != 0) if (global_pointer != 0)
regcache_cooked_write_unsigned (regcache, IA64_GR1_REGNUM, global_pointer); regcache_cooked_write_unsigned (regcache, IA64_GR1_REGNUM, global_pointer);
@ -3571,14 +3618,15 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
static struct frame_id static struct frame_id
ia64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) ia64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
char buf[8]; char buf[8];
CORE_ADDR sp, bsp; CORE_ADDR sp, bsp;
get_frame_register (this_frame, sp_regnum, buf); get_frame_register (this_frame, sp_regnum, buf);
sp = extract_unsigned_integer (buf, 8); sp = extract_unsigned_integer (buf, 8, byte_order);
get_frame_register (this_frame, IA64_BSP_REGNUM, buf); get_frame_register (this_frame, IA64_BSP_REGNUM, buf);
bsp = extract_unsigned_integer (buf, 8); bsp = extract_unsigned_integer (buf, 8, byte_order);
if (gdbarch_debug >= 1) if (gdbarch_debug >= 1)
fprintf_unfiltered (gdb_stdlog, fprintf_unfiltered (gdb_stdlog,
@ -3592,13 +3640,14 @@ ia64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
static CORE_ADDR static CORE_ADDR
ia64_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) ia64_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
char buf[8]; char buf[8];
CORE_ADDR ip, psr, pc; CORE_ADDR ip, psr, pc;
frame_unwind_register (next_frame, IA64_IP_REGNUM, buf); frame_unwind_register (next_frame, IA64_IP_REGNUM, buf);
ip = extract_unsigned_integer (buf, 8); ip = extract_unsigned_integer (buf, 8, byte_order);
frame_unwind_register (next_frame, IA64_PSR_REGNUM, buf); frame_unwind_register (next_frame, IA64_PSR_REGNUM, buf);
psr = extract_unsigned_integer (buf, 8); psr = extract_unsigned_integer (buf, 8, byte_order);
pc = (ip & ~0xf) | ((psr >> 41) & 3); pc = (ip & ~0xf) | ((psr >> 41) & 3);
return pc; return pc;

View file

@ -196,7 +196,7 @@
struct gdbarch_tdep struct gdbarch_tdep
{ {
CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int); CORE_ADDR (*sigcontext_register_address) (struct gdbarch *, CORE_ADDR, int);
int (*pc_in_sigtramp) (CORE_ADDR); int (*pc_in_sigtramp) (CORE_ADDR);
/* ISA-specific data types. */ /* ISA-specific data types. */

View file

@ -90,8 +90,10 @@ static CORE_ADDR
iq2000_pointer_to_address (struct gdbarch *gdbarch, iq2000_pointer_to_address (struct gdbarch *gdbarch,
struct type * type, const gdb_byte * buf) struct type * type, const gdb_byte * buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); CORE_ADDR addr
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
if (target == TYPE_CODE_FUNC if (target == TYPE_CODE_FUNC
|| target == TYPE_CODE_METHOD || target == TYPE_CODE_METHOD
@ -108,11 +110,12 @@ static void
iq2000_address_to_pointer (struct gdbarch *gdbarch, iq2000_address_to_pointer (struct gdbarch *gdbarch,
struct type *type, gdb_byte *buf, CORE_ADDR addr) struct type *type, gdb_byte *buf, CORE_ADDR addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type)); enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD) if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
addr = insn_ptr_from_addr (addr); addr = insn_ptr_from_addr (addr);
store_unsigned_integer (buf, TYPE_LENGTH (type), addr); store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
} }
/* Real register methods: */ /* Real register methods: */
@ -195,11 +198,13 @@ find_last_line_symbol (CORE_ADDR start, CORE_ADDR end, int notcurrent)
Returns the address of the first instruction after the prologue. */ Returns the address of the first instruction after the prologue. */
static CORE_ADDR static CORE_ADDR
iq2000_scan_prologue (CORE_ADDR scan_start, iq2000_scan_prologue (struct gdbarch *gdbarch,
CORE_ADDR scan_start,
CORE_ADDR scan_end, CORE_ADDR scan_end,
struct frame_info *fi, struct frame_info *fi,
struct iq2000_frame_cache *cache) struct iq2000_frame_cache *cache)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct symtab_and_line sal; struct symtab_and_line sal;
CORE_ADDR pc; CORE_ADDR pc;
CORE_ADDR loop_end; CORE_ADDR loop_end;
@ -234,7 +239,7 @@ iq2000_scan_prologue (CORE_ADDR scan_start,
for (pc = scan_start; pc < loop_end; pc += 4) for (pc = scan_start; pc < loop_end; pc += 4)
{ {
LONGEST insn = read_memory_unsigned_integer (pc, 4); LONGEST insn = read_memory_unsigned_integer (pc, 4, byte_order);
/* Skip any instructions writing to (sp) or decrementing the /* Skip any instructions writing to (sp) or decrementing the
SP. */ SP. */
if ((insn & 0xffe00000) == 0xac200000) if ((insn & 0xffe00000) == 0xac200000)
@ -351,7 +356,7 @@ iq2000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* No useable line symbol. Use prologue parsing method. */ /* No useable line symbol. Use prologue parsing method. */
iq2000_init_frame_cache (&cache); iq2000_init_frame_cache (&cache);
return iq2000_scan_prologue (func_addr, func_end, NULL, &cache); return iq2000_scan_prologue (gdbarch, func_addr, func_end, NULL, &cache);
} }
/* No function symbol -- just return the PC. */ /* No function symbol -- just return the PC. */
@ -361,6 +366,7 @@ iq2000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
static struct iq2000_frame_cache * static struct iq2000_frame_cache *
iq2000_frame_cache (struct frame_info *this_frame, void **this_cache) iq2000_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct iq2000_frame_cache *cache; struct iq2000_frame_cache *cache;
CORE_ADDR current_pc; CORE_ADDR current_pc;
int i; int i;
@ -379,7 +385,7 @@ iq2000_frame_cache (struct frame_info *this_frame, void **this_cache)
current_pc = get_frame_pc (this_frame); current_pc = get_frame_pc (this_frame);
find_pc_partial_function (current_pc, NULL, &cache->pc, NULL); find_pc_partial_function (current_pc, NULL, &cache->pc, NULL);
if (cache->pc != 0) if (cache->pc != 0)
iq2000_scan_prologue (cache->pc, current_pc, this_frame, cache); iq2000_scan_prologue (gdbarch, cache->pc, current_pc, this_frame, cache);
if (!cache->using_fp) if (!cache->using_fp)
cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM); cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
@ -531,6 +537,9 @@ static void
iq2000_extract_return_value (struct type *type, struct regcache *regcache, iq2000_extract_return_value (struct type *type, struct regcache *regcache,
void *valbuf) void *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* If the function's return value is 8 bytes or less, it is /* If the function's return value is 8 bytes or less, it is
returned in a register, and if larger than 8 bytes, it is returned in a register, and if larger than 8 bytes, it is
returned in a stack location which is pointed to by the same returned in a stack location which is pointed to by the same
@ -551,7 +560,7 @@ iq2000_extract_return_value (struct type *type, struct regcache *regcache,
/* By using store_unsigned_integer we avoid having to /* By using store_unsigned_integer we avoid having to
do anything special for small big-endian values. */ do anything special for small big-endian values. */
regcache_cooked_read_unsigned (regcache, regno++, &tmp); regcache_cooked_read_unsigned (regcache, regno++, &tmp);
store_unsigned_integer (valbuf, size, tmp); store_unsigned_integer (valbuf, size, byte_order, tmp);
len -= size; len -= size;
valbuf = ((char *) valbuf) + size; valbuf = ((char *) valbuf) + size;
} }
@ -636,6 +645,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const bfd_byte *val; const bfd_byte *val;
bfd_byte buf[4]; bfd_byte buf[4];
struct type *type; struct type *type;
@ -767,7 +777,7 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_unsigned (regcache, argreg++, struct_ptr); regcache_cooked_write_unsigned (regcache, argreg++, struct_ptr);
else else
{ {
store_unsigned_integer (buf, 4, struct_ptr); store_unsigned_integer (buf, 4, byte_order, struct_ptr);
write_memory (sp + stackspace, buf, 4); write_memory (sp + stackspace, buf, 4);
stackspace += 4; stackspace += 4;
} }

View file

@ -84,6 +84,7 @@ fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
greg_t *regp = &(*gregsetp)[0]; greg_t *regp = &(*gregsetp)[0];
gdb_byte buf[MAX_REGISTER_SIZE]; gdb_byte buf[MAX_REGISTER_SIZE];
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Under Irix6, if GDB is built with N32 ABI and is debugging an O32 /* Under Irix6, if GDB is built with N32 ABI and is debugging an O32
executable, we have to sign extend the registers to 64 bits before executable, we have to sign extend the registers to 64 bits before
@ -94,7 +95,7 @@ fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
{ {
size = register_size (gdbarch, regi); size = register_size (gdbarch, regi);
regcache_raw_collect (regcache, regi, buf); regcache_raw_collect (regcache, regi, buf);
*(regp + regi) = extract_signed_integer (buf, size); *(regp + regi) = extract_signed_integer (buf, size, byte_order);
} }
if ((regno == -1) || (regno == gdbarch_pc_regnum (gdbarch))) if ((regno == -1) || (regno == gdbarch_pc_regnum (gdbarch)))
@ -102,7 +103,7 @@ fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
regi = mips_regnum (gdbarch)->pc; regi = mips_regnum (gdbarch)->pc;
size = register_size (gdbarch, regi); size = register_size (gdbarch, regi);
regcache_raw_collect (regcache, regi, buf); regcache_raw_collect (regcache, regi, buf);
*(regp + CTX_EPC) = extract_signed_integer (buf, size); *(regp + CTX_EPC) = extract_signed_integer (buf, size, byte_order);
} }
if ((regno == -1) || (regno == mips_regnum (gdbarch)->cause)) if ((regno == -1) || (regno == mips_regnum (gdbarch)->cause))
@ -110,7 +111,7 @@ fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
regi = mips_regnum (gdbarch)->cause; regi = mips_regnum (gdbarch)->cause;
size = register_size (gdbarch, regi); size = register_size (gdbarch, regi);
regcache_raw_collect (regcache, regi, buf); regcache_raw_collect (regcache, regi, buf);
*(regp + CTX_CAUSE) = extract_signed_integer (buf, size); *(regp + CTX_CAUSE) = extract_signed_integer (buf, size, byte_order);
} }
if ((regno == -1) || (regno == mips_regnum (gdbarch)->hi)) if ((regno == -1) || (regno == mips_regnum (gdbarch)->hi))
@ -118,7 +119,7 @@ fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
regi = mips_regnum (gdbarch)->hi; regi = mips_regnum (gdbarch)->hi;
size = register_size (gdbarch, regi); size = register_size (gdbarch, regi);
regcache_raw_collect (regcache, regi, buf); regcache_raw_collect (regcache, regi, buf);
*(regp + CTX_MDHI) = extract_signed_integer (buf, size); *(regp + CTX_MDHI) = extract_signed_integer (buf, size, byte_order);
} }
if ((regno == -1) || (regno == mips_regnum (gdbarch)->lo)) if ((regno == -1) || (regno == mips_regnum (gdbarch)->lo))
@ -126,7 +127,7 @@ fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
regi = mips_regnum (gdbarch)->lo; regi = mips_regnum (gdbarch)->lo;
size = register_size (gdbarch, regi); size = register_size (gdbarch, regi);
regcache_raw_collect (regcache, regi, buf); regcache_raw_collect (regcache, regi, buf);
*(regp + CTX_MDLO) = extract_signed_integer (buf, size); *(regp + CTX_MDLO) = extract_signed_integer (buf, size, byte_order);
} }
} }

View file

@ -907,6 +907,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp,
if (TYPE_CODE (type) == TYPE_CODE_STRUCT if (TYPE_CODE (type) == TYPE_CODE_STRUCT
&& i > 2 && name[i - 1] == ']') && i > 2 && name[i - 1] == ']')
{ {
enum bfd_endian byte_order = gdbarch_byte_order (exp->gdbarch);
CORE_ADDR address; CORE_ADDR address;
long length, index; long length, index;
struct type *el_type; struct type *el_type;
@ -927,7 +928,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp,
address = value_as_address (arg1); address = value_as_address (arg1);
address += get_java_object_header_size (exp->gdbarch); address += get_java_object_header_size (exp->gdbarch);
read_memory (address, buf4, 4); read_memory (address, buf4, 4);
length = (long) extract_signed_integer (buf4, 4); length = (long) extract_signed_integer (buf4, 4, byte_order);
index = (long) value_as_long (arg2); index = (long) value_as_long (arg2);
if (index >= length || index < 0) if (index >= length || index < 0)
error (_("array index (%ld) out of bounds (length: %ld)"), error (_("array index (%ld) out of bounds (length: %ld)"),

View file

@ -39,6 +39,7 @@ java_value_print (struct value *val, struct ui_file *stream,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct gdbarch *gdbarch = get_type_arch (value_type (val)); struct gdbarch *gdbarch = get_type_arch (value_type (val));
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct type *type; struct type *type;
CORE_ADDR address; CORE_ADDR address;
int i; int i;
@ -81,7 +82,7 @@ java_value_print (struct value *val, struct ui_file *stream,
i = 0; i = 0;
read_memory (address + get_java_object_header_size (gdbarch), buf4, 4); read_memory (address + get_java_object_header_size (gdbarch), buf4, 4);
length = (long) extract_signed_integer (buf4, 4); length = (long) extract_signed_integer (buf4, 4, byte_order);
fprintf_filtered (stream, "{length: %ld", length); fprintf_filtered (stream, "{length: %ld", length);
if (el_type == NULL) if (el_type == NULL)
@ -110,7 +111,8 @@ java_value_print (struct value *val, struct ui_file *stream,
pulls a host sized pointer out of the target and pulls a host sized pointer out of the target and
then extracts that as an address (while assuming then extracts that as an address (while assuming
that the address is unsigned)! */ that the address is unsigned)! */
element = extract_unsigned_integer (buf, sizeof (buf)); element = extract_unsigned_integer (buf, sizeof (buf),
byte_order);
} }
for (reps = 1; i + reps < length; reps++) for (reps = 1; i + reps < length; reps++)
@ -121,7 +123,8 @@ java_value_print (struct value *val, struct ui_file *stream,
pulls a host sized pointer out of the target and pulls a host sized pointer out of the target and
then extracts that as an address (while assuming then extracts that as an address (while assuming
that the address is unsigned)! */ that the address is unsigned)! */
next_element = extract_unsigned_integer (buf, sizeof (buf)); next_element = extract_unsigned_integer (buf, sizeof (buf),
byte_order);
if (next_element != element) if (next_element != element)
break; break;
} }

View file

@ -125,9 +125,11 @@ lm32_cannot_store_register (struct gdbarch *gdbarch, int regno)
/* Analyze a function's prologue. */ /* Analyze a function's prologue. */
static CORE_ADDR static CORE_ADDR
lm32_analyze_prologue (CORE_ADDR pc, CORE_ADDR limit, lm32_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR pc, CORE_ADDR limit,
struct lm32_frame_cache *info) struct lm32_frame_cache *info)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned long instruction; unsigned long instruction;
/* Keep reading though instructions, until we come across an instruction /* Keep reading though instructions, until we come across an instruction
@ -137,7 +139,7 @@ lm32_analyze_prologue (CORE_ADDR pc, CORE_ADDR limit,
{ {
/* Read an instruction. */ /* Read an instruction. */
instruction = read_memory_integer (pc, 4); instruction = read_memory_integer (pc, 4, byte_order);
if ((LM32_OPCODE (instruction) == OP_SW) if ((LM32_OPCODE (instruction) == OP_SW)
&& (LM32_REG0 (instruction) == SIM_LM32_SP_REGNUM)) && (LM32_REG0 (instruction) == SIM_LM32_SP_REGNUM))
@ -211,7 +213,7 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
limit_pc = pc + 100; /* Magic. */ limit_pc = pc + 100; /* Magic. */
frame_info.saved_regs = saved_regs; frame_info.saved_regs = saved_regs;
return lm32_analyze_prologue (pc, limit_pc, &frame_info); return lm32_analyze_prologue (gdbarch, pc, limit_pc, &frame_info);
} }
/* Create a breakpoint instruction. */ /* Create a breakpoint instruction. */
@ -235,6 +237,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int first_arg_reg = SIM_LM32_R1_REGNUM; int first_arg_reg = SIM_LM32_R1_REGNUM;
int num_arg_regs = 8; int num_arg_regs = 8;
int i; int i;
@ -283,7 +286,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
contents = (gdb_byte *) value_contents (arg); contents = (gdb_byte *) value_contents (arg);
len = TYPE_LENGTH (arg_type); len = TYPE_LENGTH (arg_type);
val = extract_unsigned_integer (contents, len); val = extract_unsigned_integer (contents, len, byte_order);
/* First num_arg_regs parameters are passed by registers, /* First num_arg_regs parameters are passed by registers,
and the rest are passed on the stack. */ and the rest are passed on the stack. */
@ -309,6 +312,8 @@ static void
lm32_extract_return_value (struct type *type, struct regcache *regcache, lm32_extract_return_value (struct type *type, struct regcache *regcache,
gdb_byte *valbuf) gdb_byte *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int offset; int offset;
ULONGEST l; ULONGEST l;
CORE_ADDR return_buffer; CORE_ADDR return_buffer;
@ -319,7 +324,7 @@ lm32_extract_return_value (struct type *type, struct regcache *regcache,
{ {
/* Return value is returned in a single register. */ /* Return value is returned in a single register. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l); regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
store_unsigned_integer (valbuf, TYPE_LENGTH (type), l); store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, l);
} }
else if ((TYPE_CODE (type) == TYPE_CODE_INT) && (TYPE_LENGTH (type) == 8)) else if ((TYPE_CODE (type) == TYPE_CODE_INT) && (TYPE_LENGTH (type) == 8))
{ {
@ -345,19 +350,21 @@ static void
lm32_store_return_value (struct type *type, struct regcache *regcache, lm32_store_return_value (struct type *type, struct regcache *regcache,
const gdb_byte *valbuf) const gdb_byte *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val; ULONGEST val;
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
if (len <= 4) if (len <= 4)
{ {
val = extract_unsigned_integer (valbuf, len); val = extract_unsigned_integer (valbuf, len, byte_order);
regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val); regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val);
} }
else if (len <= 8) else if (len <= 8)
{ {
val = extract_unsigned_integer (valbuf, 4); val = extract_unsigned_integer (valbuf, 4, byte_order);
regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val); regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val);
val = extract_unsigned_integer (valbuf + 4, len - 4); val = extract_unsigned_integer (valbuf + 4, len - 4, byte_order);
regcache_cooked_write_unsigned (regcache, SIM_LM32_R2_REGNUM, val); regcache_cooked_write_unsigned (regcache, SIM_LM32_R2_REGNUM, val);
} }
else else
@ -435,7 +442,8 @@ lm32_frame_cache (struct frame_info *this_frame, void **this_prologue_cache)
info->pc = get_frame_func (this_frame); info->pc = get_frame_func (this_frame);
current_pc = get_frame_pc (this_frame); current_pc = get_frame_pc (this_frame);
lm32_analyze_prologue (info->pc, current_pc, info); lm32_analyze_prologue (get_frame_arch (this_frame),
info->pc, current_pc, info);
/* Compute the frame's base, and the previous frame's SP. */ /* Compute the frame's base, and the previous frame's SP. */
this_base = get_frame_register_unsigned (this_frame, SIM_LM32_SP_REGNUM); this_base = get_frame_register_unsigned (this_frame, SIM_LM32_SP_REGNUM);

View file

@ -2003,6 +2003,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
CORE_ADDR struct_addr) CORE_ADDR struct_addr)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach; unsigned long mach = gdbarch_bfd_arch_info (gdbarch)->mach;
CORE_ADDR cfa; CORE_ADDR cfa;
int i; int i;
@ -2040,7 +2041,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
int ptr_len = TYPE_LENGTH (tdep->ptr_voyd); int ptr_len = TYPE_LENGTH (tdep->ptr_voyd);
sp -= ptr_len; sp -= ptr_len;
write_memory_unsigned_integer (sp, ptr_len, struct_addr); write_memory_unsigned_integer (sp, ptr_len, byte_order, struct_addr);
} }
/* Push the arguments. */ /* Push the arguments. */
@ -2061,7 +2062,8 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
sure it ends up in the least significant end of r1. (GDB sure it ends up in the least significant end of r1. (GDB
should avoid assuming endianness, even on uni-endian should avoid assuming endianness, even on uni-endian
processors.) */ processors.) */
ULONGEST u = extract_unsigned_integer (arg_bits, arg_size); ULONGEST u = extract_unsigned_integer (arg_bits, arg_size,
byte_order);
struct m32c_reg *reg = (mach == bfd_mach_m16c) ? tdep->r1 : tdep->r0; struct m32c_reg *reg = (mach == bfd_mach_m16c) ? tdep->r1 : tdep->r0;
regcache_cooked_write_unsigned (regcache, reg->num, u); regcache_cooked_write_unsigned (regcache, reg->num, u);
} }
@ -2092,7 +2094,8 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Push the return address. */ /* Push the return address. */
sp -= tdep->ret_addr_bytes; sp -= tdep->ret_addr_bytes;
write_memory_unsigned_integer (sp, tdep->ret_addr_bytes, bp_addr); write_memory_unsigned_integer (sp, tdep->ret_addr_bytes, byte_order,
bp_addr);
/* Update the stack pointer. */ /* Update the stack pointer. */
regcache_cooked_write_unsigned (regcache, tdep->sp->num, sp); regcache_cooked_write_unsigned (regcache, tdep->sp->num, sp);
@ -2178,6 +2181,7 @@ m32c_return_value (struct gdbarch *gdbarch,
const gdb_byte *writebuf) const gdb_byte *writebuf)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum return_value_convention conv; enum return_value_convention conv;
ULONGEST valtype_len = TYPE_LENGTH (valtype); ULONGEST valtype_len = TYPE_LENGTH (valtype);
@ -2200,7 +2204,7 @@ m32c_return_value (struct gdbarch *gdbarch,
{ {
ULONGEST u; ULONGEST u;
regcache_cooked_read_unsigned (regcache, tdep->r0->num, &u); regcache_cooked_read_unsigned (regcache, tdep->r0->num, &u);
store_unsigned_integer (readbuf, valtype_len, u); store_unsigned_integer (readbuf, valtype_len, byte_order, u);
} }
else else
{ {
@ -2230,7 +2234,8 @@ m32c_return_value (struct gdbarch *gdbarch,
/* Anything that fits in r0 is returned there. */ /* Anything that fits in r0 is returned there. */
if (valtype_len <= TYPE_LENGTH (tdep->r0->type)) if (valtype_len <= TYPE_LENGTH (tdep->r0->type))
{ {
ULONGEST u = extract_unsigned_integer (writebuf, valtype_len); ULONGEST u = extract_unsigned_integer (writebuf, valtype_len,
byte_order);
regcache_cooked_write_unsigned (regcache, tdep->r0->num, u); regcache_cooked_write_unsigned (regcache, tdep->r0->num, u);
} }
else else
@ -2306,7 +2311,9 @@ m32c_return_value (struct gdbarch *gdbarch,
static CORE_ADDR static CORE_ADDR
m32c_skip_trampoline_code (struct frame_info *frame, CORE_ADDR stop_pc) m32c_skip_trampoline_code (struct frame_info *frame, CORE_ADDR stop_pc)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame)); struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* It would be nicer to simply look up the addresses of known /* It would be nicer to simply look up the addresses of known
trampolines once, and then compare stop_pc with them. However, trampolines once, and then compare stop_pc with them. However,
@ -2329,13 +2336,14 @@ m32c_skip_trampoline_code (struct frame_info *frame, CORE_ADDR stop_pc)
m32c_jsri*16*. */ m32c_jsri*16*. */
CORE_ADDR sp = get_frame_sp (get_current_frame ()); CORE_ADDR sp = get_frame_sp (get_current_frame ());
CORE_ADDR target CORE_ADDR target
= read_memory_unsigned_integer (sp + tdep->ret_addr_bytes, 2); = read_memory_unsigned_integer (sp + tdep->ret_addr_bytes,
2, byte_order);
/* What we have now is the address of a jump instruction. /* What we have now is the address of a jump instruction.
What we need is the destination of that jump. What we need is the destination of that jump.
The opcode is 1 byte, and the destination is the next 3 bytes. The opcode is 1 byte, and the destination is the next 3 bytes.
*/ */
target = read_memory_unsigned_integer (target + 1, 3); target = read_memory_unsigned_integer (target + 1, 3, byte_order);
return target; return target;
} }
} }
@ -2403,6 +2411,7 @@ static void
m32c_m16c_address_to_pointer (struct gdbarch *gdbarch, m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
struct type *type, gdb_byte *buf, CORE_ADDR addr) struct type *type, gdb_byte *buf, CORE_ADDR addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target_code; enum type_code target_code;
gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR ||
TYPE_CODE (type) == TYPE_CODE_REF); TYPE_CODE (type) == TYPE_CODE_REF);
@ -2444,7 +2453,7 @@ m32c_m16c_address_to_pointer (struct gdbarch *gdbarch,
addr = SYMBOL_VALUE_ADDRESS (tramp_msym); addr = SYMBOL_VALUE_ADDRESS (tramp_msym);
} }
store_unsigned_integer (buf, TYPE_LENGTH (type), addr); store_unsigned_integer (buf, TYPE_LENGTH (type), byte_order, addr);
} }
@ -2452,13 +2461,14 @@ static CORE_ADDR
m32c_m16c_pointer_to_address (struct gdbarch *gdbarch, m32c_m16c_pointer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf) struct type *type, const gdb_byte *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR ptr; CORE_ADDR ptr;
enum type_code target_code; enum type_code target_code;
gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR ||
TYPE_CODE (type) == TYPE_CODE_REF); TYPE_CODE (type) == TYPE_CODE_REF);
ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type)); ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
target_code = TYPE_CODE (TYPE_TARGET_TYPE (type)); target_code = TYPE_CODE (TYPE_TARGET_TYPE (type));

View file

@ -248,15 +248,18 @@ static void
m32r_store_return_value (struct type *type, struct regcache *regcache, m32r_store_return_value (struct type *type, struct regcache *regcache,
const void *valbuf) const void *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR regval; CORE_ADDR regval;
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
regval = extract_unsigned_integer (valbuf, len > 4 ? 4 : len); regval = extract_unsigned_integer (valbuf, len > 4 ? 4 : len, byte_order);
regcache_cooked_write_unsigned (regcache, RET1_REGNUM, regval); regcache_cooked_write_unsigned (regcache, RET1_REGNUM, regval);
if (len > 4) if (len > 4)
{ {
regval = extract_unsigned_integer ((gdb_byte *) valbuf + 4, len - 4); regval = extract_unsigned_integer ((gdb_byte *) valbuf + 4,
len - 4, byte_order);
regcache_cooked_write_unsigned (regcache, RET1_REGNUM + 1, regval); regcache_cooked_write_unsigned (regcache, RET1_REGNUM + 1, regval);
} }
} }
@ -265,9 +268,11 @@ m32r_store_return_value (struct type *type, struct regcache *regcache,
should be cached because this thrashing is getting nuts. */ should be cached because this thrashing is getting nuts. */
static int static int
decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit, decode_prologue (struct gdbarch *gdbarch,
CORE_ADDR start_pc, CORE_ADDR scan_limit,
CORE_ADDR *pl_endptr, unsigned long *framelength) CORE_ADDR *pl_endptr, unsigned long *framelength)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned long framesize; unsigned long framesize;
int insn; int insn;
int op1; int op1;
@ -283,10 +288,10 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
for (current_pc = start_pc; current_pc < scan_limit; current_pc += 2) for (current_pc = start_pc; current_pc < scan_limit; current_pc += 2)
{ {
/* Check if current pc's location is readable. */ /* Check if current pc's location is readable. */
if (!safe_read_memory_integer (current_pc, 2, &return_value)) if (!safe_read_memory_integer (current_pc, 2, byte_order, &return_value))
return -1; return -1;
insn = read_memory_unsigned_integer (current_pc, 2); insn = read_memory_unsigned_integer (current_pc, 2, byte_order);
if (insn == 0x0000) if (insn == 0x0000)
break; break;
@ -308,25 +313,30 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
current_pc += 2; /* skip the immediate data */ current_pc += 2; /* skip the immediate data */
/* Check if current pc's location is readable. */ /* Check if current pc's location is readable. */
if (!safe_read_memory_integer (current_pc, 2, &return_value)) if (!safe_read_memory_integer (current_pc, 2, byte_order,
&return_value))
return -1; return -1;
if (insn == 0x8faf) /* add3 sp, sp, xxxx */ if (insn == 0x8faf) /* add3 sp, sp, xxxx */
/* add 16 bit sign-extended offset */ /* add 16 bit sign-extended offset */
{ {
framesize += framesize +=
-((short) read_memory_unsigned_integer (current_pc, 2)); -((short) read_memory_unsigned_integer (current_pc,
2, byte_order));
} }
else else
{ {
if (((insn >> 8) == 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */ if (((insn >> 8) == 0xe4) /* ld24 r4, xxxxxx; sub sp, r4 */
&& safe_read_memory_integer (current_pc + 2, 2, && safe_read_memory_integer (current_pc + 2,
2, byte_order,
&return_value) &return_value)
&& read_memory_unsigned_integer (current_pc + 2, && read_memory_unsigned_integer (current_pc + 2,
2) == 0x0f24) 2, byte_order)
== 0x0f24)
/* subtract 24 bit sign-extended negative-offset */ /* subtract 24 bit sign-extended negative-offset */
{ {
insn = read_memory_unsigned_integer (current_pc - 2, 4); insn = read_memory_unsigned_integer (current_pc - 2,
4, byte_order);
if (insn & 0x00800000) /* sign extend */ if (insn & 0x00800000) /* sign extend */
insn |= 0xff000000; /* negative */ insn |= 0xff000000; /* negative */
else else
@ -452,6 +462,7 @@ decode_prologue (CORE_ADDR start_pc, CORE_ADDR scan_limit,
static CORE_ADDR static CORE_ADDR
m32r_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) m32r_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr, func_end; CORE_ADDR func_addr, func_end;
struct symtab_and_line sal; struct symtab_and_line sal;
LONGEST return_value; LONGEST return_value;
@ -478,11 +489,11 @@ m32r_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
func_end = pc + DEFAULT_SEARCH_LIMIT; func_end = pc + DEFAULT_SEARCH_LIMIT;
/* If pc's location is not readable, just quit. */ /* If pc's location is not readable, just quit. */
if (!safe_read_memory_integer (pc, 4, &return_value)) if (!safe_read_memory_integer (pc, 4, byte_order, &return_value))
return pc; return pc;
/* Find the end of prologue. */ /* Find the end of prologue. */
if (decode_prologue (pc, func_end, &sal.end, NULL) < 0) if (decode_prologue (gdbarch, pc, func_end, &sal.end, NULL) < 0)
return pc; return pc;
return sal.end; return sal.end;
@ -669,6 +680,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct value **args, CORE_ADDR sp, int struct_return, struct value **args, CORE_ADDR sp, int struct_return,
CORE_ADDR struct_addr) CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int stack_offset, stack_alloc; int stack_offset, stack_alloc;
int argreg = ARG1_REGNUM; int argreg = ARG1_REGNUM;
int argnum; int argnum;
@ -713,7 +725,8 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (len > 8 if (len > 8
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
{ {
store_unsigned_integer (valbuf, 4, value_address (args[argnum])); store_unsigned_integer (valbuf, 4, byte_order,
value_address (args[argnum]));
typecode = TYPE_CODE_PTR; typecode = TYPE_CODE_PTR;
len = 4; len = 4;
val = valbuf; val = valbuf;
@ -741,7 +754,8 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* there's room in a register */ /* there's room in a register */
regval = regval =
extract_unsigned_integer (val, extract_unsigned_integer (val,
register_size (gdbarch, argreg)); register_size (gdbarch, argreg),
byte_order);
regcache_cooked_write_unsigned (regcache, argreg++, regval); regcache_cooked_write_unsigned (regcache, argreg++, regval);
} }
@ -767,6 +781,8 @@ static void
m32r_extract_return_value (struct type *type, struct regcache *regcache, m32r_extract_return_value (struct type *type, struct regcache *regcache,
void *dst) void *dst)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
bfd_byte *valbuf = dst; bfd_byte *valbuf = dst;
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
ULONGEST tmp; ULONGEST tmp;
@ -774,14 +790,14 @@ m32r_extract_return_value (struct type *type, struct regcache *regcache,
/* By using store_unsigned_integer we avoid having to do /* By using store_unsigned_integer we avoid having to do
anything special for small big-endian values. */ anything special for small big-endian values. */
regcache_cooked_read_unsigned (regcache, RET1_REGNUM, &tmp); regcache_cooked_read_unsigned (regcache, RET1_REGNUM, &tmp);
store_unsigned_integer (valbuf, (len > 4 ? len - 4 : len), tmp); store_unsigned_integer (valbuf, (len > 4 ? len - 4 : len), byte_order, tmp);
/* Ignore return values more than 8 bytes in size because the m32r /* Ignore return values more than 8 bytes in size because the m32r
returns anything more than 8 bytes in the stack. */ returns anything more than 8 bytes in the stack. */
if (len > 4) if (len > 4)
{ {
regcache_cooked_read_unsigned (regcache, RET1_REGNUM + 1, &tmp); regcache_cooked_read_unsigned (regcache, RET1_REGNUM + 1, &tmp);
store_unsigned_integer (valbuf + len - 4, 4, tmp); store_unsigned_integer (valbuf + len - 4, 4, byte_order, tmp);
} }
} }

View file

@ -284,6 +284,8 @@ m68hc11_pseudo_register_read (struct gdbarch *gdbarch,
struct regcache *regcache, struct regcache *regcache,
int regno, gdb_byte *buf) int regno, gdb_byte *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* The PC is a pseudo reg only for 68HC12 with the memory bank /* The PC is a pseudo reg only for 68HC12 with the memory bank
addressing mode. */ addressing mode. */
if (regno == M68HC12_HARD_PC_REGNUM) if (regno == M68HC12_HARD_PC_REGNUM)
@ -301,7 +303,7 @@ m68hc11_pseudo_register_read (struct gdbarch *gdbarch,
pc += (page << 14); pc += (page << 14);
pc += 0x1000000; pc += 0x1000000;
} }
store_unsigned_integer (buf, regsize, pc); store_unsigned_integer (buf, regsize, byte_order, pc);
return; return;
} }
@ -325,6 +327,8 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
struct regcache *regcache, struct regcache *regcache,
int regno, const gdb_byte *buf) int regno, const gdb_byte *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* The PC is a pseudo reg only for 68HC12 with the memory bank /* The PC is a pseudo reg only for 68HC12 with the memory bank
addressing mode. */ addressing mode. */
if (regno == M68HC12_HARD_PC_REGNUM) if (regno == M68HC12_HARD_PC_REGNUM)
@ -334,7 +338,7 @@ m68hc11_pseudo_register_write (struct gdbarch *gdbarch,
CORE_ADDR pc; CORE_ADDR pc;
memcpy (tmp, buf, regsize); memcpy (tmp, buf, regsize);
pc = extract_unsigned_integer (tmp, regsize); pc = extract_unsigned_integer (tmp, regsize, byte_order);
if (pc >= 0x1000000) if (pc >= 0x1000000)
{ {
pc -= 0x1000000; pc -= 0x1000000;
@ -497,9 +501,11 @@ static struct insn_sequence m6812_prologue[] = {
Returns a pointer to the sequence when it is recognized and Returns a pointer to the sequence when it is recognized and
the optional value (constant/address) associated with it. */ the optional value (constant/address) associated with it. */
static struct insn_sequence * static struct insn_sequence *
m68hc11_analyze_instruction (struct insn_sequence *seq, CORE_ADDR pc, m68hc11_analyze_instruction (struct gdbarch *gdbarch,
struct insn_sequence *seq, CORE_ADDR pc,
CORE_ADDR *val) CORE_ADDR *val)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned char buffer[MAX_CODES]; unsigned char buffer[MAX_CODES];
unsigned bufsize; unsigned bufsize;
unsigned j; unsigned j;
@ -515,7 +521,7 @@ m68hc11_analyze_instruction (struct insn_sequence *seq, CORE_ADDR pc,
if (bufsize < j + 1) if (bufsize < j + 1)
{ {
buffer[bufsize] = read_memory_unsigned_integer (pc + bufsize, buffer[bufsize] = read_memory_unsigned_integer (pc + bufsize,
1); 1, byte_order);
bufsize++; bufsize++;
} }
/* Continue while we match the opcode. */ /* Continue while we match the opcode. */
@ -551,13 +557,13 @@ m68hc11_analyze_instruction (struct insn_sequence *seq, CORE_ADDR pc,
} }
else if ((buffer[j] & 0xfe) == 0xf0) else if ((buffer[j] & 0xfe) == 0xf0)
{ {
v = read_memory_unsigned_integer (pc + j + 1, 1); v = read_memory_unsigned_integer (pc + j + 1, 1, byte_order);
if (buffer[j] & 1) if (buffer[j] & 1)
v |= 0xff00; v |= 0xff00;
} }
else if (buffer[j] == 0xf2) else if (buffer[j] == 0xf2)
{ {
v = read_memory_unsigned_integer (pc + j + 1, 2); v = read_memory_unsigned_integer (pc + j + 1, 2, byte_order);
} }
cur_val = v; cur_val = v;
break; break;
@ -678,7 +684,7 @@ m68hc11_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
struct insn_sequence *seq; struct insn_sequence *seq;
CORE_ADDR val; CORE_ADDR val;
seq = m68hc11_analyze_instruction (seq_table, pc, &val); seq = m68hc11_analyze_instruction (gdbarch, seq_table, pc, &val);
if (seq == 0) if (seq == 0)
break; break;
@ -1158,6 +1164,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int nargs, struct value **args, CORE_ADDR sp, int nargs, struct value **args, CORE_ADDR sp,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int argnum; int argnum;
int first_stack_argnum; int first_stack_argnum;
struct type *type; struct type *type;
@ -1180,7 +1187,8 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
ULONGEST v; ULONGEST v;
v = extract_unsigned_integer (value_contents (args[0]), len); v = extract_unsigned_integer (value_contents (args[0]),
len, byte_order);
first_stack_argnum = 1; first_stack_argnum = 1;
regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v); regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v);
@ -1211,7 +1219,7 @@ m68hc11_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Store return address. */ /* Store return address. */
sp -= 2; sp -= 2;
store_unsigned_integer (buf, 2, bp_addr); store_unsigned_integer (buf, 2, byte_order, bp_addr);
write_memory (sp, buf, 2); write_memory (sp, buf, 2);
/* Finally, update the stack pointer... */ /* Finally, update the stack pointer... */

View file

@ -495,6 +495,7 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
CORE_ADDR struct_addr) CORE_ADDR struct_addr)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[4]; gdb_byte buf[4];
int i; int i;
@ -522,17 +523,17 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Store struct value address. */ /* Store struct value address. */
if (struct_return) if (struct_return)
{ {
store_unsigned_integer (buf, 4, struct_addr); store_unsigned_integer (buf, 4, byte_order, struct_addr);
regcache_cooked_write (regcache, tdep->struct_value_regnum, buf); regcache_cooked_write (regcache, tdep->struct_value_regnum, buf);
} }
/* Store return address. */ /* Store return address. */
sp -= 4; sp -= 4;
store_unsigned_integer (buf, 4, bp_addr); store_unsigned_integer (buf, 4, byte_order, bp_addr);
write_memory (sp, buf, 4); write_memory (sp, buf, 4);
/* Finally, update the stack pointer... */ /* Finally, update the stack pointer... */
store_unsigned_integer (buf, 4, sp); store_unsigned_integer (buf, 4, byte_order, sp);
regcache_cooked_write (regcache, M68K_SP_REGNUM, buf); regcache_cooked_write (regcache, M68K_SP_REGNUM, buf);
/* ...and fake a frame pointer. */ /* ...and fake a frame pointer. */
@ -613,15 +614,17 @@ m68k_alloc_frame_cache (void)
Otherwise, return PC. */ Otherwise, return PC. */
static CORE_ADDR static CORE_ADDR
m68k_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc, m68k_analyze_frame_setup (struct gdbarch *gdbarch,
CORE_ADDR pc, CORE_ADDR current_pc,
struct m68k_frame_cache *cache) struct m68k_frame_cache *cache)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int op; int op;
if (pc >= current_pc) if (pc >= current_pc)
return current_pc; return current_pc;
op = read_memory_unsigned_integer (pc, 2); op = read_memory_unsigned_integer (pc, 2, byte_order);
if (op == P_LINKW_FP || op == P_LINKL_FP || op == P_PEA_FP) if (op == P_LINKW_FP || op == P_LINKL_FP || op == P_PEA_FP)
{ {
@ -631,14 +634,14 @@ m68k_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc,
{ {
/* link.w %fp, #-N */ /* link.w %fp, #-N */
/* link.w %fp, #0; adda.l #-N, %sp */ /* link.w %fp, #0; adda.l #-N, %sp */
cache->locals = -read_memory_integer (pc + 2, 2); cache->locals = -read_memory_integer (pc + 2, 2, byte_order);
if (pc + 4 < current_pc && cache->locals == 0) if (pc + 4 < current_pc && cache->locals == 0)
{ {
op = read_memory_unsigned_integer (pc + 4, 2); op = read_memory_unsigned_integer (pc + 4, 2, byte_order);
if (op == P_ADDAL_SP) if (op == P_ADDAL_SP)
{ {
cache->locals = read_memory_integer (pc + 6, 4); cache->locals = read_memory_integer (pc + 6, 4, byte_order);
return pc + 10; return pc + 10;
} }
} }
@ -648,7 +651,7 @@ m68k_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc,
else if (op == P_LINKL_FP) else if (op == P_LINKL_FP)
{ {
/* link.l %fp, #-N */ /* link.l %fp, #-N */
cache->locals = -read_memory_integer (pc + 2, 4); cache->locals = -read_memory_integer (pc + 2, 4, byte_order);
return pc + 6; return pc + 6;
} }
else else
@ -658,7 +661,7 @@ m68k_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc,
if (pc + 2 < current_pc) if (pc + 2 < current_pc)
{ {
op = read_memory_unsigned_integer (pc + 2, 2); op = read_memory_unsigned_integer (pc + 2, 2, byte_order);
if (op == P_MOVEAL_SP_FP) if (op == P_MOVEAL_SP_FP)
{ {
@ -677,7 +680,7 @@ m68k_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc,
cache->locals = (op & 07000) == 0 ? 8 : (op & 07000) >> 9; cache->locals = (op & 07000) == 0 ? 8 : (op & 07000) >> 9;
if (pc + 2 < current_pc) if (pc + 2 < current_pc)
{ {
op = read_memory_unsigned_integer (pc + 2, 2); op = read_memory_unsigned_integer (pc + 2, 2, byte_order);
if ((op & 0170777) == P_SUBQW_SP || (op & 0170777) == P_SUBQL_SP) if ((op & 0170777) == P_SUBQW_SP || (op & 0170777) == P_SUBQL_SP)
{ {
cache->locals += (op & 07000) == 0 ? 8 : (op & 07000) >> 9; cache->locals += (op & 07000) == 0 ? 8 : (op & 07000) >> 9;
@ -690,13 +693,13 @@ m68k_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc,
{ {
/* adda.w #-N,%sp */ /* adda.w #-N,%sp */
/* lea (-N,%sp),%sp */ /* lea (-N,%sp),%sp */
cache->locals = -read_memory_integer (pc + 2, 2); cache->locals = -read_memory_integer (pc + 2, 2, byte_order);
return pc + 4; return pc + 4;
} }
else if (op == P_ADDAL_SP) else if (op == P_ADDAL_SP)
{ {
/* adda.l #-N,%sp */ /* adda.l #-N,%sp */
cache->locals = -read_memory_integer (pc + 2, 4); cache->locals = -read_memory_integer (pc + 2, 4, byte_order);
return pc + 6; return pc + 6;
} }
@ -713,6 +716,8 @@ m68k_analyze_register_saves (struct gdbarch *gdbarch, CORE_ADDR pc,
CORE_ADDR current_pc, CORE_ADDR current_pc,
struct m68k_frame_cache *cache) struct m68k_frame_cache *cache)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (cache->locals >= 0) if (cache->locals >= 0)
{ {
CORE_ADDR offset; CORE_ADDR offset;
@ -722,12 +727,12 @@ m68k_analyze_register_saves (struct gdbarch *gdbarch, CORE_ADDR pc,
offset = -4 - cache->locals; offset = -4 - cache->locals;
while (pc < current_pc) while (pc < current_pc)
{ {
op = read_memory_unsigned_integer (pc, 2); op = read_memory_unsigned_integer (pc, 2, byte_order);
if (op == P_FMOVEMX_SP if (op == P_FMOVEMX_SP
&& gdbarch_tdep (gdbarch)->fpregs_present) && gdbarch_tdep (gdbarch)->fpregs_present)
{ {
/* fmovem.x REGS,-(%sp) */ /* fmovem.x REGS,-(%sp) */
op = read_memory_unsigned_integer (pc + 2, 2); op = read_memory_unsigned_integer (pc + 2, 2, byte_order);
if ((op & 0xff00) == 0xe000) if ((op & 0xff00) == 0xe000)
{ {
mask = op & 0xff; mask = op & 0xff;
@ -755,7 +760,7 @@ m68k_analyze_register_saves (struct gdbarch *gdbarch, CORE_ADDR pc,
else if (op == P_MOVEML_SP) else if (op == P_MOVEML_SP)
{ {
/* movem.l REGS,-(%sp) */ /* movem.l REGS,-(%sp) */
mask = read_memory_unsigned_integer (pc + 2, 2); mask = read_memory_unsigned_integer (pc + 2, 2, byte_order);
for (i = 0; i < 16; i++, mask >>= 1) for (i = 0; i < 16; i++, mask >>= 1)
{ {
if (mask & 1) if (mask & 1)
@ -811,15 +816,16 @@ static CORE_ADDR
m68k_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, m68k_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
CORE_ADDR current_pc, struct m68k_frame_cache *cache) CORE_ADDR current_pc, struct m68k_frame_cache *cache)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int op; unsigned int op;
pc = m68k_analyze_frame_setup (pc, current_pc, cache); pc = m68k_analyze_frame_setup (gdbarch, pc, current_pc, cache);
pc = m68k_analyze_register_saves (gdbarch, pc, current_pc, cache); pc = m68k_analyze_register_saves (gdbarch, pc, current_pc, cache);
if (pc >= current_pc) if (pc >= current_pc)
return current_pc; return current_pc;
/* Check for GOT setup. */ /* Check for GOT setup. */
op = read_memory_unsigned_integer (pc, 4); op = read_memory_unsigned_integer (pc, 4, byte_order);
if (op == P_LEA_PC_A5) if (op == P_LEA_PC_A5)
{ {
/* lea (%pc,N),%a5 */ /* lea (%pc,N),%a5 */
@ -859,6 +865,8 @@ m68k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
static struct m68k_frame_cache * static struct m68k_frame_cache *
m68k_frame_cache (struct frame_info *this_frame, void **this_cache) m68k_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct m68k_frame_cache *cache; struct m68k_frame_cache *cache;
gdb_byte buf[4]; gdb_byte buf[4];
int i; int i;
@ -879,7 +887,7 @@ m68k_frame_cache (struct frame_info *this_frame, void **this_cache)
in progress when the signal occurred. */ in progress when the signal occurred. */
get_frame_register (this_frame, M68K_FP_REGNUM, buf); get_frame_register (this_frame, M68K_FP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4); cache->base = extract_unsigned_integer (buf, 4, byte_order);
if (cache->base == 0) if (cache->base == 0)
return cache; return cache;
@ -902,7 +910,8 @@ m68k_frame_cache (struct frame_info *this_frame, void **this_cache)
functions this might work too. */ functions this might work too. */
get_frame_register (this_frame, M68K_SP_REGNUM, buf); get_frame_register (this_frame, M68K_SP_REGNUM, buf);
cache->base = extract_unsigned_integer (buf, 4) + cache->sp_offset; cache->base = extract_unsigned_integer (buf, 4, byte_order)
+ cache->sp_offset;
} }
/* Now that we have the base address for the stack frame we can /* Now that we have the base address for the stack frame we can
@ -998,7 +1007,8 @@ m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
gdb_byte *buf; gdb_byte *buf;
CORE_ADDR sp, jb_addr; CORE_ADDR sp, jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame)); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (tdep->jb_pc < 0) if (tdep->jb_pc < 0)
{ {
@ -1015,14 +1025,15 @@ m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
return 0; return 0;
jb_addr = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch) jb_addr = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch)
/ TARGET_CHAR_BIT); / TARGET_CHAR_BIT, byte_order);
if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf, if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT)) gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT),
byte_order)
return 0; return 0;
*pc = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch) *pc = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch)
/ TARGET_CHAR_BIT); / TARGET_CHAR_BIT, byte_order);
return 1; return 1;
} }

View file

@ -65,6 +65,8 @@
static int static int
m68k_linux_pc_in_sigtramp (struct frame_info *this_frame) m68k_linux_pc_in_sigtramp (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp; CORE_ADDR sp;
gdb_byte buf[12]; gdb_byte buf[12];
unsigned long insn0, insn1, insn2; unsigned long insn0, insn1, insn2;
@ -72,14 +74,14 @@ m68k_linux_pc_in_sigtramp (struct frame_info *this_frame)
if (!safe_frame_unwind_memory (this_frame, pc - 4, buf, sizeof (buf))) if (!safe_frame_unwind_memory (this_frame, pc - 4, buf, sizeof (buf)))
return 0; return 0;
insn1 = extract_unsigned_integer (buf + 4, 4); insn1 = extract_unsigned_integer (buf + 4, 4, byte_order);
insn2 = extract_unsigned_integer (buf + 8, 4); insn2 = extract_unsigned_integer (buf + 8, 4, byte_order);
if (IS_SIGTRAMP (insn1, insn2)) if (IS_SIGTRAMP (insn1, insn2))
return 1; return 1;
if (IS_RT_SIGTRAMP (insn1, insn2)) if (IS_RT_SIGTRAMP (insn1, insn2))
return 2; return 2;
insn0 = extract_unsigned_integer (buf, 4); insn0 = extract_unsigned_integer (buf, 4, byte_order);
if (IS_SIGTRAMP (insn0, insn1)) if (IS_SIGTRAMP (insn0, insn1))
return 1; return 1;
if (IS_RT_SIGTRAMP (insn0, insn1)) if (IS_RT_SIGTRAMP (insn0, insn1))
@ -222,6 +224,8 @@ m68k_linux_inferior_created (struct target_ops *objfile, int from_tty)
static struct m68k_linux_sigtramp_info static struct m68k_linux_sigtramp_info
m68k_linux_get_sigtramp_info (struct frame_info *this_frame) m68k_linux_get_sigtramp_info (struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR sp; CORE_ADDR sp;
struct m68k_linux_sigtramp_info info; struct m68k_linux_sigtramp_info info;
@ -239,7 +243,7 @@ m68k_linux_get_sigtramp_info (struct frame_info *this_frame)
sp = get_frame_register_unsigned (this_frame, M68K_SP_REGNUM); sp = get_frame_register_unsigned (this_frame, M68K_SP_REGNUM);
/* Get sigcontext address, it is the third parameter on the stack. */ /* Get sigcontext address, it is the third parameter on the stack. */
info.sigcontext_addr = read_memory_unsigned_integer (sp + 8, 4); info.sigcontext_addr = read_memory_unsigned_integer (sp + 8, 4, byte_order);
if (m68k_linux_pc_in_sigtramp (this_frame) == 2) if (m68k_linux_pc_in_sigtramp (this_frame) == 2)
info.sc_reg_offset = m68k_linux_ucontext_reg_offset; info.sc_reg_offset = m68k_linux_ucontext_reg_offset;
@ -258,7 +262,9 @@ m68k_linux_sigtramp_frame_cache (struct frame_info *this_frame,
{ {
struct frame_id this_id; struct frame_id this_id;
struct trad_frame_cache *cache; struct trad_frame_cache *cache;
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct m68k_linux_sigtramp_info info; struct m68k_linux_sigtramp_info info;
gdb_byte buf[4]; gdb_byte buf[4];
int i; int i;
@ -274,8 +280,8 @@ m68k_linux_sigtramp_frame_cache (struct frame_info *this_frame,
trampoline. */ trampoline. */
get_frame_register (this_frame, M68K_SP_REGNUM, buf); get_frame_register (this_frame, M68K_SP_REGNUM, buf);
/* See the end of m68k_push_dummy_call. */ /* See the end of m68k_push_dummy_call. */
this_id = frame_id_build (extract_unsigned_integer (buf, 4) - 4 + 8, this_id = frame_id_build (extract_unsigned_integer (buf, 4, byte_order)
get_frame_pc (this_frame)); - 4 + 8, get_frame_pc (this_frame));
trad_frame_set_id (cache, this_id); trad_frame_set_id (cache, this_id);
info = m68k_linux_get_sigtramp_info (this_frame); info = m68k_linux_get_sigtramp_info (this_frame);

View file

@ -39,9 +39,9 @@
/* Fetch the instruction at PC. */ /* Fetch the instruction at PC. */
static unsigned long static unsigned long
m88k_fetch_instruction (CORE_ADDR pc) m88k_fetch_instruction (CORE_ADDR pc, enum bfd_endian byte_order)
{ {
return read_memory_unsigned_integer (pc, 4); return read_memory_unsigned_integer (pc, 4, byte_order);
} }
/* Register information. */ /* Register information. */
@ -526,9 +526,11 @@ struct m88k_prologue_insn m88k_prologue_insn_table[] =
prologue. */ prologue. */
static CORE_ADDR static CORE_ADDR
m88k_analyze_prologue (CORE_ADDR pc, CORE_ADDR limit, m88k_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR pc, CORE_ADDR limit,
struct m88k_frame_cache *cache) struct m88k_frame_cache *cache)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR end = limit; CORE_ADDR end = limit;
/* Provide a dummy cache if necessary. */ /* Provide a dummy cache if necessary. */
@ -548,7 +550,7 @@ m88k_analyze_prologue (CORE_ADDR pc, CORE_ADDR limit,
while (pc < limit) while (pc < limit)
{ {
struct m88k_prologue_insn *pi = m88k_prologue_insn_table; struct m88k_prologue_insn *pi = m88k_prologue_insn_table;
unsigned long insn = m88k_fetch_instruction (pc); unsigned long insn = m88k_fetch_instruction (pc, byte_order);
while ((insn & pi->mask) != pi->insn) while ((insn & pi->mask) != pi->insn)
pi++; pi++;
@ -643,12 +645,14 @@ m88k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
return sal.end; return sal.end;
} }
return m88k_analyze_prologue (pc, pc + m88k_max_prologue_size, NULL); return m88k_analyze_prologue (gdbarch, pc, pc + m88k_max_prologue_size,
NULL);
} }
static struct m88k_frame_cache * static struct m88k_frame_cache *
m88k_frame_cache (struct frame_info *this_frame, void **this_cache) m88k_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct m88k_frame_cache *cache; struct m88k_frame_cache *cache;
CORE_ADDR frame_sp; CORE_ADDR frame_sp;
@ -661,7 +665,8 @@ m88k_frame_cache (struct frame_info *this_frame, void **this_cache)
cache->pc = get_frame_func (this_frame); cache->pc = get_frame_func (this_frame);
if (cache->pc != 0) if (cache->pc != 0)
m88k_analyze_prologue (cache->pc, get_frame_pc (this_frame), cache); m88k_analyze_prologue (gdbarch, cache->pc, get_frame_pc (this_frame),
cache);
/* Calculate the stack pointer used in the prologue. */ /* Calculate the stack pointer used in the prologue. */
if (cache->fp_offset != -1) if (cache->fp_offset != -1)

View file

@ -1139,6 +1139,7 @@ mep_pseudo_cr32_read (struct gdbarch *gdbarch,
int cookednum, int cookednum,
void *buf) void *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Read the raw register into a 64-bit buffer, and then return the /* Read the raw register into a 64-bit buffer, and then return the
appropriate end of that buffer. */ appropriate end of that buffer. */
int rawnum = mep_pseudo_to_raw[cookednum]; int rawnum = mep_pseudo_to_raw[cookednum];
@ -1148,7 +1149,8 @@ mep_pseudo_cr32_read (struct gdbarch *gdbarch,
gdb_assert (TYPE_LENGTH (register_type (gdbarch, cookednum)) == 4); gdb_assert (TYPE_LENGTH (register_type (gdbarch, cookednum)) == 4);
regcache_raw_read (regcache, rawnum, buf64); regcache_raw_read (regcache, rawnum, buf64);
/* Slow, but legible. */ /* Slow, but legible. */
store_unsigned_integer (buf, 4, extract_unsigned_integer (buf64, 8)); store_unsigned_integer (buf, 4, byte_order,
extract_unsigned_integer (buf64, 8, byte_order));
} }
@ -1188,6 +1190,7 @@ mep_pseudo_csr_write (struct gdbarch *gdbarch,
int cookednum, int cookednum,
const void *buf) const void *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, cookednum); int size = register_size (gdbarch, cookednum);
struct mep_csr_register *r struct mep_csr_register *r
= &mep_csr_registers[cookednum - MEP_FIRST_CSR_REGNUM]; = &mep_csr_registers[cookednum - MEP_FIRST_CSR_REGNUM];
@ -1204,7 +1207,7 @@ mep_pseudo_csr_write (struct gdbarch *gdbarch,
ULONGEST mixed_bits; ULONGEST mixed_bits;
regcache_raw_read_unsigned (regcache, r->raw, &old_bits); regcache_raw_read_unsigned (regcache, r->raw, &old_bits);
new_bits = extract_unsigned_integer (buf, size); new_bits = extract_unsigned_integer (buf, size, byte_order);
mixed_bits = ((r->writeable_bits & new_bits) mixed_bits = ((r->writeable_bits & new_bits)
| (~r->writeable_bits & old_bits)); | (~r->writeable_bits & old_bits));
regcache_raw_write_unsigned (regcache, r->raw, mixed_bits); regcache_raw_write_unsigned (regcache, r->raw, mixed_bits);
@ -1218,6 +1221,7 @@ mep_pseudo_cr32_write (struct gdbarch *gdbarch,
int cookednum, int cookednum,
const void *buf) const void *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* Expand the 32-bit value into a 64-bit value, and write that to /* Expand the 32-bit value into a 64-bit value, and write that to
the pseudoregister. */ the pseudoregister. */
int rawnum = mep_pseudo_to_raw[cookednum]; int rawnum = mep_pseudo_to_raw[cookednum];
@ -1226,7 +1230,8 @@ mep_pseudo_cr32_write (struct gdbarch *gdbarch,
gdb_assert (TYPE_LENGTH (register_type (gdbarch, rawnum)) == sizeof (buf64)); gdb_assert (TYPE_LENGTH (register_type (gdbarch, rawnum)) == sizeof (buf64));
gdb_assert (TYPE_LENGTH (register_type (gdbarch, cookednum)) == 4); gdb_assert (TYPE_LENGTH (register_type (gdbarch, cookednum)) == 4);
/* Slow, but legible. */ /* Slow, but legible. */
store_unsigned_integer (buf64, 8, extract_unsigned_integer (buf, 4)); store_unsigned_integer (buf64, 8, byte_order,
extract_unsigned_integer (buf, 4, byte_order));
regcache_raw_write (regcache, rawnum, buf64); regcache_raw_write (regcache, rawnum, buf64);
} }
@ -1415,8 +1420,9 @@ mep_pc_in_vliw_section (CORE_ADDR pc)
anyway. */ anyway. */
static CORE_ADDR static CORE_ADDR
mep_get_insn (CORE_ADDR pc, long *insn) mep_get_insn (struct gdbarch *gdbarch, CORE_ADDR pc, long *insn)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int pc_in_vliw_section; int pc_in_vliw_section;
int vliw_mode; int vliw_mode;
int insn_len; int insn_len;
@ -1453,7 +1459,7 @@ mep_get_insn (CORE_ADDR pc, long *insn)
vliw_mode = 0; vliw_mode = 0;
read_memory (pc, buf, sizeof (buf)); read_memory (pc, buf, sizeof (buf));
*insn = extract_unsigned_integer (buf, 2) << 16; *insn = extract_unsigned_integer (buf, 2, byte_order) << 16;
/* The major opcode --- the top four bits of the first 16-bit /* The major opcode --- the top four bits of the first 16-bit
part --- indicates whether this instruction is 16 or 32 bits part --- indicates whether this instruction is 16 or 32 bits
@ -1463,7 +1469,7 @@ mep_get_insn (CORE_ADDR pc, long *insn)
{ {
/* Fetch the second 16-bit part of the instruction. */ /* Fetch the second 16-bit part of the instruction. */
read_memory (pc + 2, buf, sizeof (buf)); read_memory (pc + 2, buf, sizeof (buf));
*insn = *insn | extract_unsigned_integer (buf, 2); *insn = *insn | extract_unsigned_integer (buf, 2, byte_order);
} }
/* If we're in VLIW code, then the VLIW width determines the address /* If we're in VLIW code, then the VLIW width determines the address
@ -1700,7 +1706,7 @@ mep_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR next_pc; CORE_ADDR next_pc;
pv_t pre_insn_fp, pre_insn_sp; pv_t pre_insn_fp, pre_insn_sp;
next_pc = mep_get_insn (pc, &insn); next_pc = mep_get_insn (gdbarch, pc, &insn);
/* A zero return from mep_get_insn means that either we weren't /* A zero return from mep_get_insn means that either we weren't
able to read the instruction from memory, or that we don't able to read the instruction from memory, or that we don't
@ -2294,6 +2300,7 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int struct_return, int struct_return,
CORE_ADDR struct_addr) CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR *copy = (CORE_ADDR *) alloca (argc * sizeof (copy[0])); CORE_ADDR *copy = (CORE_ADDR *) alloca (argc * sizeof (copy[0]));
CORE_ADDR func_addr = find_function_addr (function, NULL); CORE_ADDR func_addr = find_function_addr (function, NULL);
int i; int i;
@ -2334,7 +2341,8 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Arguments that fit in a GPR get expanded to fill the GPR. */ /* Arguments that fit in a GPR get expanded to fill the GPR. */
if (arg_size <= MEP_GPR_SIZE) if (arg_size <= MEP_GPR_SIZE)
value = extract_unsigned_integer (value_contents (argv[i]), value = extract_unsigned_integer (value_contents (argv[i]),
TYPE_LENGTH (value_type (argv[i]))); TYPE_LENGTH (value_type (argv[i])),
byte_order);
/* Arguments too large to fit in a GPR get copied to the stack, /* Arguments too large to fit in a GPR get copied to the stack,
and we pass a pointer to the copy. */ and we pass a pointer to the copy. */
@ -2350,7 +2358,7 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
else else
{ {
char buf[MEP_GPR_SIZE]; char buf[MEP_GPR_SIZE];
store_unsigned_integer (buf, MEP_GPR_SIZE, value); store_unsigned_integer (buf, MEP_GPR_SIZE, byte_order, value);
write_memory (arg_stack, buf, MEP_GPR_SIZE); write_memory (arg_stack, buf, MEP_GPR_SIZE);
arg_stack += MEP_GPR_SIZE; arg_stack += MEP_GPR_SIZE;
} }

View file

@ -1030,6 +1030,8 @@ mi_cmd_data_read_memory (char *command, char **argv, int argc)
void void
mi_cmd_data_write_memory (char *command, char **argv, int argc) mi_cmd_data_write_memory (char *command, char **argv, int argc)
{ {
struct gdbarch *gdbarch = get_current_arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR addr; CORE_ADDR addr;
char word_format; char word_format;
long word_size; long word_size;
@ -1087,7 +1089,7 @@ mi_cmd_data_write_memory (char *command, char **argv, int argc)
/* Get the value into an array. */ /* Get the value into an array. */
buffer = xmalloc (word_size); buffer = xmalloc (word_size);
old_chain = make_cleanup (xfree, buffer); old_chain = make_cleanup (xfree, buffer);
store_signed_integer (buffer, word_size, value); store_signed_integer (buffer, word_size, byte_order, value);
/* Write it down to memory. */ /* Write it down to memory. */
write_memory (addr, buffer, word_size); write_memory (addr, buffer, word_size);
/* Free the buffer. */ /* Free the buffer. */

View file

@ -55,6 +55,7 @@ mips_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{ {
CORE_ADDR jb_addr; CORE_ADDR jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
char buf[gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT]; char buf[gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT];
jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM); jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM);
@ -65,7 +66,8 @@ mips_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
return 0; return 0;
*pc = extract_unsigned_integer (buf, *pc = extract_unsigned_integer (buf,
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT); gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT,
byte_order);
return 1; return 1;
} }
@ -77,10 +79,11 @@ mips_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
static void static void
supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr) supply_32bit_reg (struct regcache *regcache, int regnum, const void *addr)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[MAX_REGISTER_SIZE]; gdb_byte buf[MAX_REGISTER_SIZE];
store_signed_integer (buf, store_signed_integer (buf, register_size (gdbarch, regnum), byte_order,
register_size (get_regcache_arch (regcache), regnum), extract_signed_integer (addr, 4, byte_order));
extract_signed_integer (addr, 4));
regcache_raw_supply (regcache, regnum, buf); regcache_raw_supply (regcache, regnum, buf);
} }
@ -258,6 +261,7 @@ mips64_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{ {
CORE_ADDR jb_addr; CORE_ADDR jb_addr;
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
void *buf = alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT); void *buf = alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
int element_size = gdbarch_ptr_bit (gdbarch) == 32 ? 4 : 8; int element_size = gdbarch_ptr_bit (gdbarch) == 32 ? 4 : 8;
@ -269,7 +273,8 @@ mips64_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
return 0; return 0;
*pc = extract_unsigned_integer (buf, *pc = extract_unsigned_integer (buf,
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT); gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT,
byte_order);
return 1; return 1;
} }
@ -343,6 +348,7 @@ mips64_fill_gregset (const struct regcache *regcache,
mips64_elf_gregset_t *gregsetp, int regno) mips64_elf_gregset_t *gregsetp, int regno)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int regaddr, regi; int regaddr, regi;
mips64_elf_greg_t *regp = *gregsetp; mips64_elf_greg_t *regp = *gregsetp;
void *dst; void *dst;
@ -388,9 +394,10 @@ mips64_fill_gregset (const struct regcache *regcache,
LONGEST val; LONGEST val;
regcache_raw_collect (regcache, regno, buf); regcache_raw_collect (regcache, regno, buf);
val = extract_signed_integer (buf, register_size (gdbarch, regno)); val = extract_signed_integer (buf, register_size (gdbarch, regno),
byte_order);
dst = regp + regaddr; dst = regp + regaddr;
store_signed_integer (dst, 8, val); store_signed_integer (dst, 8, byte_order, val);
} }
} }
@ -440,6 +447,7 @@ mips64_fill_fpregset (const struct regcache *regcache,
mips64_elf_fpregset_t *fpregsetp, int regno) mips64_elf_fpregset_t *fpregsetp, int regno)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte *to; gdb_byte *to;
if ((regno >= gdbarch_fp0_regnum (gdbarch)) if ((regno >= gdbarch_fp0_regnum (gdbarch))
@ -468,9 +476,10 @@ mips64_fill_fpregset (const struct regcache *regcache,
LONGEST val; LONGEST val;
regcache_raw_collect (regcache, regno, buf); regcache_raw_collect (regcache, regno, buf);
val = extract_signed_integer (buf, register_size (gdbarch, regno)); val = extract_signed_integer (buf, register_size (gdbarch, regno),
byte_order);
to = (gdb_byte *) (*fpregsetp + 32); to = (gdb_byte *) (*fpregsetp + 32);
store_signed_integer (to, 4, val); store_signed_integer (to, 4, byte_order, val);
} }
else if (regno == mips_regnum (gdbarch)->fp_implementation_revision) else if (regno == mips_regnum (gdbarch)->fp_implementation_revision)
{ {
@ -478,9 +487,10 @@ mips64_fill_fpregset (const struct regcache *regcache,
LONGEST val; LONGEST val;
regcache_raw_collect (regcache, regno, buf); regcache_raw_collect (regcache, regno, buf);
val = extract_signed_integer (buf, register_size (gdbarch, regno)); val = extract_signed_integer (buf, register_size (gdbarch, regno),
byte_order);
to = (gdb_byte *) (*fpregsetp + 32) + 4; to = (gdb_byte *) (*fpregsetp + 32) + 4;
store_signed_integer (to, 4, val); store_signed_integer (to, 4, byte_order, val);
} }
else if (regno == -1) else if (regno == -1)
{ {
@ -605,6 +615,7 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name)
unsigned char buf[28], *p; unsigned char buf[28], *p;
ULONGEST insn, insn1; ULONGEST insn, insn1;
int n64 = (mips_abi (target_gdbarch) == MIPS_ABI_N64); int n64 = (mips_abi (target_gdbarch) == MIPS_ABI_N64);
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
read_memory (pc - 12, buf, 28); read_memory (pc - 12, buf, 28);
@ -622,7 +633,7 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name)
p = buf + 12; p = buf + 12;
while (p >= buf) while (p >= buf)
{ {
insn = extract_unsigned_integer (p, 4); insn = extract_unsigned_integer (p, 4, byte_order);
if (insn == insn1) if (insn == insn1)
break; break;
p -= 4; p -= 4;
@ -630,7 +641,7 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name)
if (p < buf) if (p < buf)
return 0; return 0;
insn = extract_unsigned_integer (p + 4, 4); insn = extract_unsigned_integer (p + 4, 4, byte_order);
if (n64) if (n64)
{ {
/* daddu t7,ra */ /* daddu t7,ra */
@ -644,12 +655,12 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name)
return 0; return 0;
} }
insn = extract_unsigned_integer (p + 8, 4); insn = extract_unsigned_integer (p + 8, 4, byte_order);
/* jalr t9,ra */ /* jalr t9,ra */
if (insn != 0x0320f809) if (insn != 0x0320f809)
return 0; return 0;
insn = extract_unsigned_integer (p + 12, 4); insn = extract_unsigned_integer (p + 12, 4, byte_order);
if (n64) if (n64)
{ {
/* daddiu t8,zero,0 */ /* daddiu t8,zero,0 */

View file

@ -880,8 +880,9 @@ mips_write_pc (struct regcache *regcache, CORE_ADDR pc)
is odd, assume it's a MIPS16 instruction; otherwise MIPS32. */ is odd, assume it's a MIPS16 instruction; otherwise MIPS32. */
static ULONGEST static ULONGEST
mips_fetch_instruction (CORE_ADDR addr) mips_fetch_instruction (struct gdbarch *gdbarch, CORE_ADDR addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[MIPS_INSN32_SIZE]; gdb_byte buf[MIPS_INSN32_SIZE];
int instlen; int instlen;
int status; int status;
@ -896,7 +897,7 @@ mips_fetch_instruction (CORE_ADDR addr)
status = target_read_memory (addr, buf, instlen); status = target_read_memory (addr, buf, instlen);
if (status) if (status)
memory_error (status, addr); memory_error (status, addr);
return extract_unsigned_integer (buf, instlen); return extract_unsigned_integer (buf, instlen, byte_order);
} }
/* These the fields of 32 bit mips instructions */ /* These the fields of 32 bit mips instructions */
@ -927,9 +928,10 @@ mips32_relative_offset (ULONGEST inst)
static CORE_ADDR static CORE_ADDR
mips32_next_pc (struct frame_info *frame, CORE_ADDR pc) mips32_next_pc (struct frame_info *frame, CORE_ADDR pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame);
unsigned long inst; unsigned long inst;
int op; int op;
inst = mips_fetch_instruction (pc); inst = mips_fetch_instruction (gdbarch, pc);
if ((inst & 0xe0000000) != 0) /* Not a special, jump or branch instruction */ if ((inst & 0xe0000000) != 0) /* Not a special, jump or branch instruction */
{ {
if (itype_op (inst) >> 2 == 5) if (itype_op (inst) >> 2 == 5)
@ -1151,16 +1153,17 @@ extended_offset (unsigned int extension)
when the offset is to be used in relative addressing. */ when the offset is to be used in relative addressing. */
static unsigned int static unsigned int
fetch_mips_16 (CORE_ADDR pc) fetch_mips_16 (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[8]; gdb_byte buf[8];
pc &= 0xfffffffe; /* clear the low order bit */ pc &= 0xfffffffe; /* clear the low order bit */
target_read_memory (pc, buf, 2); target_read_memory (pc, buf, 2);
return extract_unsigned_integer (buf, 2); return extract_unsigned_integer (buf, 2, byte_order);
} }
static void static void
unpack_mips16 (CORE_ADDR pc, unpack_mips16 (struct gdbarch *gdbarch, CORE_ADDR pc,
unsigned int extension, unsigned int extension,
unsigned int inst, unsigned int inst,
enum mips16_inst_fmts insn_format, struct upk_mips16 *upk) enum mips16_inst_fmts insn_format, struct upk_mips16 *upk)
@ -1228,7 +1231,7 @@ unpack_mips16 (CORE_ADDR pc,
unsigned int nexthalf; unsigned int nexthalf;
value = ((inst & 0x1f) << 5) | ((inst >> 5) & 0x1f); value = ((inst & 0x1f) << 5) | ((inst >> 5) & 0x1f);
value = value << 16; value = value << 16;
nexthalf = mips_fetch_instruction (pc + 2); /* low bit still set */ nexthalf = mips_fetch_instruction (gdbarch, pc + 2); /* low bit still set */
value |= nexthalf; value |= nexthalf;
offset = value; offset = value;
regx = -1; regx = -1;
@ -1254,6 +1257,7 @@ static CORE_ADDR
extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc, extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
unsigned int extension, unsigned int insn) unsigned int extension, unsigned int insn)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame);
int op = (insn >> 11); int op = (insn >> 11);
switch (op) switch (op)
{ {
@ -1261,7 +1265,7 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
{ {
CORE_ADDR offset; CORE_ADDR offset;
struct upk_mips16 upk; struct upk_mips16 upk;
unpack_mips16 (pc, extension, insn, itype, &upk); unpack_mips16 (gdbarch, pc, extension, insn, itype, &upk);
offset = upk.offset; offset = upk.offset;
if (offset & 0x800) if (offset & 0x800)
{ {
@ -1274,7 +1278,7 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
case 3: /* JAL , JALX - Watch out, these are 32 bit instruction */ case 3: /* JAL , JALX - Watch out, these are 32 bit instruction */
{ {
struct upk_mips16 upk; struct upk_mips16 upk;
unpack_mips16 (pc, extension, insn, jalxtype, &upk); unpack_mips16 (gdbarch, pc, extension, insn, jalxtype, &upk);
pc = add_offset_16 (pc, upk.offset); pc = add_offset_16 (pc, upk.offset);
if ((insn >> 10) & 0x01) /* Exchange mode */ if ((insn >> 10) & 0x01) /* Exchange mode */
pc = pc & ~0x01; /* Clear low bit, indicate 32 bit mode */ pc = pc & ~0x01; /* Clear low bit, indicate 32 bit mode */
@ -1286,7 +1290,7 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
{ {
struct upk_mips16 upk; struct upk_mips16 upk;
int reg; int reg;
unpack_mips16 (pc, extension, insn, ritype, &upk); unpack_mips16 (gdbarch, pc, extension, insn, ritype, &upk);
reg = get_frame_register_signed (frame, upk.regx); reg = get_frame_register_signed (frame, upk.regx);
if (reg == 0) if (reg == 0)
pc += (upk.offset << 1) + 2; pc += (upk.offset << 1) + 2;
@ -1298,7 +1302,7 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
{ {
struct upk_mips16 upk; struct upk_mips16 upk;
int reg; int reg;
unpack_mips16 (pc, extension, insn, ritype, &upk); unpack_mips16 (gdbarch, pc, extension, insn, ritype, &upk);
reg = get_frame_register_signed (frame, upk.regx); reg = get_frame_register_signed (frame, upk.regx);
if (reg != 0) if (reg != 0)
pc += (upk.offset << 1) + 2; pc += (upk.offset << 1) + 2;
@ -1310,7 +1314,7 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
{ {
struct upk_mips16 upk; struct upk_mips16 upk;
int reg; int reg;
unpack_mips16 (pc, extension, insn, i8type, &upk); unpack_mips16 (gdbarch, pc, extension, insn, i8type, &upk);
/* upk.regx contains the opcode */ /* upk.regx contains the opcode */
reg = get_frame_register_signed (frame, 24); /* Test register is 24 */ reg = get_frame_register_signed (frame, 24); /* Test register is 24 */
if (((upk.regx == 0) && (reg == 0)) /* BTEZ */ if (((upk.regx == 0) && (reg == 0)) /* BTEZ */
@ -1358,7 +1362,8 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
that. */ that. */
{ {
pc += 2; pc += 2;
pc = extended_mips16_next_pc (frame, pc, insn, fetch_mips_16 (pc)); pc = extended_mips16_next_pc (frame, pc, insn,
fetch_mips_16 (gdbarch, pc));
break; break;
} }
default: default:
@ -1373,7 +1378,8 @@ extended_mips16_next_pc (struct frame_info *frame, CORE_ADDR pc,
static CORE_ADDR static CORE_ADDR
mips16_next_pc (struct frame_info *frame, CORE_ADDR pc) mips16_next_pc (struct frame_info *frame, CORE_ADDR pc)
{ {
unsigned int insn = fetch_mips_16 (pc); struct gdbarch *gdbarch = get_frame_arch (frame);
unsigned int insn = fetch_mips_16 (gdbarch, pc);
return extended_mips16_next_pc (frame, pc, 0, insn); return extended_mips16_next_pc (frame, pc, 0, insn);
} }
@ -1463,7 +1469,8 @@ mips16_get_imm (unsigned short prev_inst, /* previous instruction */
Return the address of the first instruction past the prologue. */ Return the address of the first instruction past the prologue. */
static CORE_ADDR static CORE_ADDR
mips16_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc, mips16_scan_prologue (struct gdbarch *gdbarch,
CORE_ADDR start_pc, CORE_ADDR limit_pc,
struct frame_info *this_frame, struct frame_info *this_frame,
struct mips_frame_cache *this_cache) struct mips_frame_cache *this_cache)
{ {
@ -1482,7 +1489,6 @@ mips16_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
int extend_bytes = 0; int extend_bytes = 0;
int prev_extend_bytes; int prev_extend_bytes;
CORE_ADDR end_prologue_addr = 0; CORE_ADDR end_prologue_addr = 0;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
/* Can be called when there's no process, and hence when there's no /* Can be called when there's no process, and hence when there's no
THIS_FRAME. */ THIS_FRAME. */
@ -1503,7 +1509,7 @@ mips16_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
prev_inst = inst; prev_inst = inst;
/* Fetch and decode the instruction. */ /* Fetch and decode the instruction. */
inst = (unsigned short) mips_fetch_instruction (cur_pc); inst = (unsigned short) mips_fetch_instruction (gdbarch, cur_pc);
/* Normally we ignore extend instructions. However, if it is /* Normally we ignore extend instructions. However, if it is
not followed by a valid prologue instruction, then this not followed by a valid prologue instruction, then this
@ -1769,6 +1775,7 @@ mips16_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
static struct mips_frame_cache * static struct mips_frame_cache *
mips_insn16_frame_cache (struct frame_info *this_frame, void **this_cache) mips_insn16_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct mips_frame_cache *cache; struct mips_frame_cache *cache;
if ((*this_cache) != NULL) if ((*this_cache) != NULL)
@ -1784,19 +1791,18 @@ mips_insn16_frame_cache (struct frame_info *this_frame, void **this_cache)
find_pc_partial_function (pc, NULL, &start_addr, NULL); find_pc_partial_function (pc, NULL, &start_addr, NULL);
if (start_addr == 0) if (start_addr == 0)
start_addr = heuristic_proc_start (get_frame_arch (this_frame), pc); start_addr = heuristic_proc_start (gdbarch, pc);
/* We can't analyze the prologue if we couldn't find the begining /* We can't analyze the prologue if we couldn't find the begining
of the function. */ of the function. */
if (start_addr == 0) if (start_addr == 0)
return cache; return cache;
mips16_scan_prologue (start_addr, pc, this_frame, *this_cache); mips16_scan_prologue (gdbarch, start_addr, pc, this_frame, *this_cache);
} }
/* gdbarch_sp_regnum contains the value and not the address. */ /* gdbarch_sp_regnum contains the value and not the address. */
trad_frame_set_value (cache->saved_regs, trad_frame_set_value (cache->saved_regs,
gdbarch_num_regs (get_frame_arch (this_frame)) gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM,
+ MIPS_SP_REGNUM,
cache->base); cache->base);
return (*this_cache); return (*this_cache);
@ -1891,7 +1897,8 @@ reset_saved_regs (struct gdbarch *gdbarch, struct mips_frame_cache *this_cache)
Return the address of the first instruction past the prologue. */ Return the address of the first instruction past the prologue. */
static CORE_ADDR static CORE_ADDR
mips32_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc, mips32_scan_prologue (struct gdbarch *gdbarch,
CORE_ADDR start_pc, CORE_ADDR limit_pc,
struct frame_info *this_frame, struct frame_info *this_frame,
struct mips_frame_cache *this_cache) struct mips_frame_cache *this_cache)
{ {
@ -1905,7 +1912,6 @@ mips32_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
int seen_sp_adjust = 0; int seen_sp_adjust = 0;
int load_immediate_bytes = 0; int load_immediate_bytes = 0;
int in_delay_slot = 0; int in_delay_slot = 0;
struct gdbarch *gdbarch = get_frame_arch (this_frame);
int regsize_is_64_bits = (mips_abi_regsize (gdbarch) == 8); int regsize_is_64_bits = (mips_abi_regsize (gdbarch) == 8);
/* Can be called when there's no process, and hence when there's no /* Can be called when there's no process, and hence when there's no
@ -1929,7 +1935,7 @@ restart:
int reg; int reg;
/* Fetch the instruction. */ /* Fetch the instruction. */
inst = (unsigned long) mips_fetch_instruction (cur_pc); inst = (unsigned long) mips_fetch_instruction (gdbarch, cur_pc);
/* Save some code by pre-extracting some useful fields. */ /* Save some code by pre-extracting some useful fields. */
high_word = (inst >> 16) & 0xffff; high_word = (inst >> 16) & 0xffff;
@ -2117,6 +2123,7 @@ restart:
static struct mips_frame_cache * static struct mips_frame_cache *
mips_insn32_frame_cache (struct frame_info *this_frame, void **this_cache) mips_insn32_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct mips_frame_cache *cache; struct mips_frame_cache *cache;
if ((*this_cache) != NULL) if ((*this_cache) != NULL)
@ -2133,19 +2140,18 @@ mips_insn32_frame_cache (struct frame_info *this_frame, void **this_cache)
find_pc_partial_function (pc, NULL, &start_addr, NULL); find_pc_partial_function (pc, NULL, &start_addr, NULL);
if (start_addr == 0) if (start_addr == 0)
start_addr = heuristic_proc_start (get_frame_arch (this_frame), pc); start_addr = heuristic_proc_start (gdbarch, pc);
/* We can't analyze the prologue if we couldn't find the begining /* We can't analyze the prologue if we couldn't find the begining
of the function. */ of the function. */
if (start_addr == 0) if (start_addr == 0)
return cache; return cache;
mips32_scan_prologue (start_addr, pc, this_frame, *this_cache); mips32_scan_prologue (gdbarch, start_addr, pc, this_frame, *this_cache);
} }
/* gdbarch_sp_regnum contains the value and not the address. */ /* gdbarch_sp_regnum contains the value and not the address. */
trad_frame_set_value (cache->saved_regs, trad_frame_set_value (cache->saved_regs,
gdbarch_num_regs (get_frame_arch (this_frame)) gdbarch_num_regs (gdbarch) + MIPS_SP_REGNUM,
+ MIPS_SP_REGNUM,
cache->base); cache->base);
return (*this_cache); return (*this_cache);
@ -2391,7 +2397,7 @@ deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
if (pc & 0x01) if (pc & 0x01)
return 0; return 0;
insn = mips_fetch_instruction (loc); insn = mips_fetch_instruction (gdbarch, loc);
/* Assume all atomic sequences start with a ll/lld instruction. */ /* Assume all atomic sequences start with a ll/lld instruction. */
if (itype_op (insn) != LL_OPCODE && itype_op (insn) != LLD_OPCODE) if (itype_op (insn) != LL_OPCODE && itype_op (insn) != LLD_OPCODE)
return 0; return 0;
@ -2402,7 +2408,7 @@ deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
int is_branch = 0; int is_branch = 0;
loc += MIPS_INSN32_SIZE; loc += MIPS_INSN32_SIZE;
insn = mips_fetch_instruction (loc); insn = mips_fetch_instruction (gdbarch, loc);
/* Assume that there is at most one branch in the atomic /* Assume that there is at most one branch in the atomic
sequence. If a branch is found, put a breakpoint in its sequence. If a branch is found, put a breakpoint in its
@ -2495,7 +2501,7 @@ mips_software_single_step (struct frame_info *frame)
end of a function. */ end of a function. */
static int static int
mips_about_to_return (CORE_ADDR pc) mips_about_to_return (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
if (mips_pc_is_mips16 (pc)) if (mips_pc_is_mips16 (pc))
/* This mips16 case isn't necessarily reliable. Sometimes the compiler /* This mips16 case isn't necessarily reliable. Sometimes the compiler
@ -2504,9 +2510,9 @@ mips_about_to_return (CORE_ADDR pc)
as $a3), then a "jr" using that register. This second case as $a3), then a "jr" using that register. This second case
is almost impossible to distinguish from an indirect jump is almost impossible to distinguish from an indirect jump
used for switch statements, so we don't even try. */ used for switch statements, so we don't even try. */
return mips_fetch_instruction (pc) == 0xe820; /* jr $ra */ return mips_fetch_instruction (gdbarch, pc) == 0xe820; /* jr $ra */
else else
return mips_fetch_instruction (pc) == 0x3e00008; /* jr $ra */ return mips_fetch_instruction (gdbarch, pc) == 0x3e00008; /* jr $ra */
} }
@ -2589,12 +2595,12 @@ heuristic-fence-post' command.\n",
addiu sp,-n addiu sp,-n
daddiu sp,-n daddiu sp,-n
extend -n followed by 'addiu sp,+n' or 'daddiu sp,+n' */ extend -n followed by 'addiu sp,+n' or 'daddiu sp,+n' */
inst = mips_fetch_instruction (start_pc); inst = mips_fetch_instruction (gdbarch, start_pc);
if ((inst & 0xff80) == 0x6480) /* save */ if ((inst & 0xff80) == 0x6480) /* save */
{ {
if (start_pc - instlen >= fence) if (start_pc - instlen >= fence)
{ {
inst = mips_fetch_instruction (start_pc - instlen); inst = mips_fetch_instruction (gdbarch, start_pc - instlen);
if ((inst & 0xf800) == 0xf000) /* extend */ if ((inst & 0xf800) == 0xf000) /* extend */
start_pc -= instlen; start_pc -= instlen;
} }
@ -2612,7 +2618,7 @@ heuristic-fence-post' command.\n",
else else
seen_adjsp = 0; seen_adjsp = 0;
} }
else if (mips_about_to_return (start_pc)) else if (mips_about_to_return (gdbarch, start_pc))
{ {
/* Skip return and its delay slot. */ /* Skip return and its delay slot. */
start_pc += 2 * MIPS_INSN32_SIZE; start_pc += 2 * MIPS_INSN32_SIZE;
@ -2697,6 +2703,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = 0; int len = 0;
int stack_offset = 0; int stack_offset = 0;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = find_function_addr (function, NULL); CORE_ADDR func_addr = find_function_addr (function, NULL);
int regsize = mips_abi_regsize (gdbarch); int regsize = mips_abi_regsize (gdbarch);
@ -2765,7 +2772,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (len > regsize if (len > regsize
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
{ {
store_unsigned_integer (valbuf, regsize, value_address (arg)); store_unsigned_integer (valbuf, regsize, byte_order,
value_address (arg));
typecode = TYPE_CODE_PTR; typecode = TYPE_CODE_PTR;
len = regsize; len = regsize;
val = valbuf; val = valbuf;
@ -2813,14 +2821,16 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
unsigned long regval; unsigned long regval;
/* Write the low word of the double to the even register(s). */ /* Write the low word of the double to the even register(s). */
regval = extract_unsigned_integer (val + low_offset, 4); regval = extract_unsigned_integer (val + low_offset,
4, byte_order);
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, 4)); float_argreg, phex (regval, 4));
regcache_cooked_write_unsigned (regcache, float_argreg++, regval); regcache_cooked_write_unsigned (regcache, float_argreg++, regval);
/* Write the high word of the double to the odd register(s). */ /* Write the high word of the double to the odd register(s). */
regval = extract_unsigned_integer (val + 4 - low_offset, 4); regval = extract_unsigned_integer (val + 4 - low_offset,
4, byte_order);
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, 4)); float_argreg, phex (regval, 4));
@ -2832,7 +2842,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
in a single register. */ in a single register. */
/* On 32 bit ABI's the float_argreg is further adjusted /* On 32 bit ABI's the float_argreg is further adjusted
above to ensure that it is even register aligned. */ above to ensure that it is even register aligned. */
LONGEST regval = extract_unsigned_integer (val, len); LONGEST regval = extract_unsigned_integer (val, len, byte_order);
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, len)); float_argreg, phex (regval, len));
@ -2919,7 +2929,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
&& !fp_register_arg_p (gdbarch, typecode, arg_type)) && !fp_register_arg_p (gdbarch, typecode, arg_type))
{ {
LONGEST regval = LONGEST regval =
extract_unsigned_integer (val, partial_len); extract_unsigned_integer (val, partial_len, byte_order);
if (mips_debug) if (mips_debug)
fprintf_filtered (gdb_stdlog, " - reg=%d val=%s", fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
@ -3084,6 +3094,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = 0; int len = 0;
int stack_offset = 0; int stack_offset = 0;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = find_function_addr (function, NULL); CORE_ADDR func_addr = find_function_addr (function, NULL);
/* For shared libraries, "t9" needs to point at the function /* For shared libraries, "t9" needs to point at the function
@ -3161,7 +3172,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* This is a floating point value that fits entirely /* This is a floating point value that fits entirely
in a single register or a pair of registers. */ in a single register or a pair of registers. */
int reglen = (len <= MIPS64_REGSIZE ? len : MIPS64_REGSIZE); int reglen = (len <= MIPS64_REGSIZE ? len : MIPS64_REGSIZE);
LONGEST regval = extract_unsigned_integer (val, reglen); LONGEST regval = extract_unsigned_integer (val, reglen, byte_order);
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, reglen)); float_argreg, phex (regval, reglen));
@ -3175,7 +3186,8 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
argreg++; argreg++;
if (len == 16) if (len == 16)
{ {
regval = extract_unsigned_integer (val + reglen, reglen); regval = extract_unsigned_integer (val + reglen,
reglen, byte_order);
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, reglen)); float_argreg, phex (regval, reglen));
@ -3275,9 +3287,11 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|| (partial_len < 4 || (partial_len < 4
&& typecode == TYPE_CODE_INT && typecode == TYPE_CODE_INT
&& !TYPE_UNSIGNED (arg_type))) && !TYPE_UNSIGNED (arg_type)))
regval = extract_signed_integer (val, partial_len); regval = extract_signed_integer (val, partial_len,
byte_order);
else else
regval = extract_unsigned_integer (val, partial_len); regval = extract_unsigned_integer (val, partial_len,
byte_order);
/* A non-floating-point argument being passed in a /* A non-floating-point argument being passed in a
general register. If a struct or union, and if general register. If a struct or union, and if
@ -3522,6 +3536,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = 0; int len = 0;
int stack_offset = 0; int stack_offset = 0;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = find_function_addr (function, NULL); CORE_ADDR func_addr = find_function_addr (function, NULL);
/* For shared libraries, "t9" needs to point at the function /* For shared libraries, "t9" needs to point at the function
@ -3624,7 +3639,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
unsigned long regval; unsigned long regval;
/* Write the low word of the double to the even register(s). */ /* Write the low word of the double to the even register(s). */
regval = extract_unsigned_integer (val + low_offset, 4); regval = extract_unsigned_integer (val + low_offset,
4, byte_order);
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, 4)); float_argreg, phex (regval, 4));
@ -3635,7 +3651,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_unsigned (regcache, argreg++, regval); regcache_cooked_write_unsigned (regcache, argreg++, regval);
/* Write the high word of the double to the odd register(s). */ /* Write the high word of the double to the odd register(s). */
regval = extract_unsigned_integer (val + 4 - low_offset, 4); regval = extract_unsigned_integer (val + 4 - low_offset,
4, byte_order);
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, 4)); float_argreg, phex (regval, 4));
@ -3652,7 +3669,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
in a single register. */ in a single register. */
/* On 32 bit ABI's the float_argreg is further adjusted /* On 32 bit ABI's the float_argreg is further adjusted
above to ensure that it is even register aligned. */ above to ensure that it is even register aligned. */
LONGEST regval = extract_unsigned_integer (val, len); LONGEST regval = extract_unsigned_integer (val, len, byte_order);
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, len)); float_argreg, phex (regval, len));
@ -3740,7 +3757,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
purpose register. */ purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch)) if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
{ {
LONGEST regval = extract_signed_integer (val, partial_len); LONGEST regval = extract_signed_integer (val, partial_len,
byte_order);
/* Value may need to be sign extended, because /* Value may need to be sign extended, because
mips_isa_regsize() != mips_abi_regsize(). */ mips_isa_regsize() != mips_abi_regsize(). */
@ -3982,6 +4000,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = 0; int len = 0;
int stack_offset = 0; int stack_offset = 0;
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = find_function_addr (function, NULL); CORE_ADDR func_addr = find_function_addr (function, NULL);
/* For shared libraries, "t9" needs to point at the function /* For shared libraries, "t9" needs to point at the function
@ -4063,7 +4082,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (fp_register_arg_p (gdbarch, typecode, arg_type) if (fp_register_arg_p (gdbarch, typecode, arg_type)
&& float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch)) && float_argreg <= MIPS_LAST_FP_ARG_REGNUM (gdbarch))
{ {
LONGEST regval = extract_unsigned_integer (val, len); LONGEST regval = extract_unsigned_integer (val, len, byte_order);
if (mips_debug) if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s", fprintf_unfiltered (gdb_stdlog, " - fpreg=%d val=%s",
float_argreg, phex (regval, len)); float_argreg, phex (regval, len));
@ -4145,7 +4164,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
purpose register. */ purpose register. */
if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch)) if (argreg <= MIPS_LAST_ARG_REGNUM (gdbarch))
{ {
LONGEST regval = extract_signed_integer (val, partial_len); LONGEST regval = extract_signed_integer (val, partial_len,
byte_order);
/* Value may need to be sign extended, because /* Value may need to be sign extended, because
mips_isa_regsize() != mips_abi_regsize(). */ mips_isa_regsize() != mips_abi_regsize(). */
@ -4649,6 +4669,7 @@ static int
mips_single_step_through_delay (struct gdbarch *gdbarch, mips_single_step_through_delay (struct gdbarch *gdbarch,
struct frame_info *frame) struct frame_info *frame)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc = get_frame_pc (frame); CORE_ADDR pc = get_frame_pc (frame);
gdb_byte buf[MIPS_INSN32_SIZE]; gdb_byte buf[MIPS_INSN32_SIZE];
@ -4663,7 +4684,7 @@ mips_single_step_through_delay (struct gdbarch *gdbarch,
/* If error reading memory, guess that it is not a delayed /* If error reading memory, guess that it is not a delayed
branch. */ branch. */
return 0; return 0;
return is_delayed (extract_unsigned_integer (buf, sizeof buf)); return is_delayed (extract_unsigned_integer (buf, sizeof buf, byte_order));
} }
/* To skip prologues, I use this predicate. Returns either PC itself /* To skip prologues, I use this predicate. Returns either PC itself
@ -4703,15 +4724,15 @@ mips_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
limit_pc = pc + 100; /* Magic. */ limit_pc = pc + 100; /* Magic. */
if (mips_pc_is_mips16 (pc)) if (mips_pc_is_mips16 (pc))
return mips16_scan_prologue (pc, limit_pc, NULL, NULL); return mips16_scan_prologue (gdbarch, pc, limit_pc, NULL, NULL);
else else
return mips32_scan_prologue (pc, limit_pc, NULL, NULL); return mips32_scan_prologue (gdbarch, pc, limit_pc, NULL, NULL);
} }
/* Check whether the PC is in a function epilogue (32-bit version). /* Check whether the PC is in a function epilogue (32-bit version).
This is a helper function for mips_in_function_epilogue_p. */ This is a helper function for mips_in_function_epilogue_p. */
static int static int
mips32_in_function_epilogue_p (CORE_ADDR pc) mips32_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
CORE_ADDR func_addr = 0, func_end = 0; CORE_ADDR func_addr = 0, func_end = 0;
@ -4730,7 +4751,7 @@ mips32_in_function_epilogue_p (CORE_ADDR pc)
unsigned long high_word; unsigned long high_word;
unsigned long inst; unsigned long inst;
inst = mips_fetch_instruction (pc); inst = mips_fetch_instruction (gdbarch, pc);
high_word = (inst >> 16) & 0xffff; high_word = (inst >> 16) & 0xffff;
if (high_word != 0x27bd /* addiu $sp,$sp,offset */ if (high_word != 0x27bd /* addiu $sp,$sp,offset */
@ -4749,7 +4770,7 @@ mips32_in_function_epilogue_p (CORE_ADDR pc)
/* Check whether the PC is in a function epilogue (16-bit version). /* Check whether the PC is in a function epilogue (16-bit version).
This is a helper function for mips_in_function_epilogue_p. */ This is a helper function for mips_in_function_epilogue_p. */
static int static int
mips16_in_function_epilogue_p (CORE_ADDR pc) mips16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
CORE_ADDR func_addr = 0, func_end = 0; CORE_ADDR func_addr = 0, func_end = 0;
@ -4767,7 +4788,7 @@ mips16_in_function_epilogue_p (CORE_ADDR pc)
{ {
unsigned short inst; unsigned short inst;
inst = mips_fetch_instruction (pc); inst = mips_fetch_instruction (gdbarch, pc);
if ((inst & 0xf800) == 0xf000) /* extend */ if ((inst & 0xf800) == 0xf000) /* extend */
continue; continue;
@ -4792,9 +4813,9 @@ static int
mips_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) mips_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
if (mips_pc_is_mips16 (pc)) if (mips_pc_is_mips16 (pc))
return mips16_in_function_epilogue_p (pc); return mips16_in_function_epilogue_p (gdbarch, pc);
else else
return mips32_in_function_epilogue_p (pc); return mips32_in_function_epilogue_p (gdbarch, pc);
} }
/* Root of all "set mips "/"show mips " commands. This will eventually be /* Root of all "set mips "/"show mips " commands. This will eventually be
@ -5077,6 +5098,7 @@ mips_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
static CORE_ADDR static CORE_ADDR
mips_skip_mips16_trampoline_code (struct frame_info *frame, CORE_ADDR pc) mips_skip_mips16_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame);
char *name; char *name;
CORE_ADDR start_addr; CORE_ADDR start_addr;
@ -5135,7 +5157,7 @@ mips_skip_mips16_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
instructions. FIXME. */ instructions. FIXME. */
for (i = 0, pc = 0; i < 20; i++, target_pc += MIPS_INSN32_SIZE) for (i = 0, pc = 0; i < 20; i++, target_pc += MIPS_INSN32_SIZE)
{ {
inst = mips_fetch_instruction (target_pc); inst = mips_fetch_instruction (gdbarch, target_pc);
if ((inst & 0xffff0000) == 0x3c010000) /* lui $at */ if ((inst & 0xffff0000) == 0x3c010000) /* lui $at */
pc = (inst << 16) & 0xffff0000; /* high word */ pc = (inst << 16) & 0xffff0000; /* high word */
else if ((inst & 0xffff0000) == 0x24210000) /* addiu $at */ else if ((inst & 0xffff0000) == 0x24210000) /* addiu $at */
@ -5161,6 +5183,8 @@ mips_skip_mips16_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
static CORE_ADDR static CORE_ADDR
mips_skip_pic_trampoline_code (struct frame_info *frame, CORE_ADDR pc) mips_skip_pic_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct minimal_symbol *msym; struct minimal_symbol *msym;
int i; int i;
gdb_byte stub_code[16]; gdb_byte stub_code[16];
@ -5186,7 +5210,8 @@ mips_skip_pic_trampoline_code (struct frame_info *frame, CORE_ADDR pc)
if (target_read_memory (pc, stub_code, 16) != 0) if (target_read_memory (pc, stub_code, 16) != 0)
return 0; return 0;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
stub_words[i] = extract_unsigned_integer (stub_code + i * 4, 4); stub_words[i] = extract_unsigned_integer (stub_code + i * 4,
4, byte_order);
/* A stub contains these instructions: /* A stub contains these instructions:
lui t9, %hi(target) lui t9, %hi(target)
@ -5298,7 +5323,8 @@ static CORE_ADDR
mips_integer_to_address (struct gdbarch *gdbarch, mips_integer_to_address (struct gdbarch *gdbarch,
struct type *type, const gdb_byte *buf) struct type *type, const gdb_byte *buf)
{ {
return (CORE_ADDR) extract_signed_integer (buf, TYPE_LENGTH (type)); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
return extract_signed_integer (buf, TYPE_LENGTH (type), byte_order);
} }
/* Dummy virtual frame pointer method. This is no more or less accurate /* Dummy virtual frame pointer method. This is no more or less accurate

View file

@ -294,6 +294,7 @@ static int
mipsnbsd_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) mipsnbsd_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{ {
struct gdbarch *gdbarch = get_frame_arch (frame); struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR jb_addr; CORE_ADDR jb_addr;
char *buf; char *buf;
@ -305,8 +306,8 @@ mipsnbsd_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch))) NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch)))
return 0; return 0;
*pc = extract_unsigned_integer (buf, NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch)); *pc = extract_unsigned_integer (buf, NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch),
byte_order);
return 1; return 1;
} }

View file

@ -387,6 +387,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR start_pc, CORE_ADDR limit_pc, CORE_ADDR start_pc, CORE_ADDR limit_pc,
struct mn10300_prologue *result) struct mn10300_prologue *result)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc, next_pc; CORE_ADDR pc, next_pc;
int rn; int rn;
pv_t regs[MN10300_MAX_NUM_REGS]; pv_t regs[MN10300_MAX_NUM_REGS];
@ -545,7 +546,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
if (status != 0) if (status != 0)
break; break;
imm8 = extract_signed_integer (buf, 1); imm8 = extract_signed_integer (buf, 1, byte_order);
regs[E_SP_REGNUM] = pv_add_constant (regs[E_SP_REGNUM], imm8); regs[E_SP_REGNUM] = pv_add_constant (regs[E_SP_REGNUM], imm8);
pc += 3; pc += 3;
@ -562,7 +563,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
if (status != 0) if (status != 0)
break; break;
imm16 = extract_signed_integer (buf, 2); imm16 = extract_signed_integer (buf, 2, byte_order);
regs[E_SP_REGNUM] = pv_add_constant (regs[E_SP_REGNUM], imm16); regs[E_SP_REGNUM] = pv_add_constant (regs[E_SP_REGNUM], imm16);
pc += 4; pc += 4;
@ -580,7 +581,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
break; break;
imm32 = extract_signed_integer (buf, 4); imm32 = extract_signed_integer (buf, 4, byte_order);
regs[E_SP_REGNUM] = pv_add_constant (regs[E_SP_REGNUM], imm32); regs[E_SP_REGNUM] = pv_add_constant (regs[E_SP_REGNUM], imm32);
pc += 6; pc += 6;
@ -594,7 +595,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
LONGEST imm8; LONGEST imm8;
aN = instr[0] & 0x03; aN = instr[0] & 0x03;
imm8 = extract_signed_integer (&instr[1], 1); imm8 = extract_signed_integer (&instr[1], 1, byte_order);
regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN], regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
imm8); imm8);
@ -615,7 +616,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
break; break;
imm16 = extract_signed_integer (buf, 2); imm16 = extract_signed_integer (buf, 2, byte_order);
regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN], regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
imm16); imm16);
@ -635,7 +636,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
if (status != 0) if (status != 0)
break; break;
imm32 = extract_signed_integer (buf, 2); imm32 = extract_signed_integer (buf, 2, byte_order);
regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN], regs[E_A0_REGNUM + aN] = pv_add_constant (regs[E_A0_REGNUM + aN],
imm32); imm32);
@ -722,7 +723,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4; sM = (buf[0] & 0xf0) >> 4;
rN = buf[0] & 0x0f; rN = buf[0] & 0x0f;
fsM = (Y << 4) | sM; fsM = (Y << 4) | sM;
d8 = extract_signed_integer (&buf[1], 1); d8 = extract_signed_integer (&buf[1], 1, byte_order);
pv_area_store (stack, pv_area_store (stack,
pv_add_constant (regs[translate_rreg (rN)], d8), pv_add_constant (regs[translate_rreg (rN)], d8),
@ -746,7 +747,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4; sM = (buf[0] & 0xf0) >> 4;
rN = buf[0] & 0x0f; rN = buf[0] & 0x0f;
fsM = (Y << 4) | sM; fsM = (Y << 4) | sM;
d24 = extract_signed_integer (&buf[1], 3); d24 = extract_signed_integer (&buf[1], 3, byte_order);
pv_area_store (stack, pv_area_store (stack,
pv_add_constant (regs[translate_rreg (rN)], d24), pv_add_constant (regs[translate_rreg (rN)], d24),
@ -770,7 +771,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4; sM = (buf[0] & 0xf0) >> 4;
rN = buf[0] & 0x0f; rN = buf[0] & 0x0f;
fsM = (Y << 4) | sM; fsM = (Y << 4) | sM;
d32 = extract_signed_integer (&buf[1], 4); d32 = extract_signed_integer (&buf[1], 4, byte_order);
pv_area_store (stack, pv_area_store (stack,
pv_add_constant (regs[translate_rreg (rN)], d32), pv_add_constant (regs[translate_rreg (rN)], d32),
@ -793,7 +794,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4; sM = (buf[0] & 0xf0) >> 4;
fsM = (Y << 4) | sM; fsM = (Y << 4) | sM;
d8 = extract_signed_integer (&buf[1], 1); d8 = extract_signed_integer (&buf[1], 1, byte_order);
pv_area_store (stack, pv_area_store (stack,
pv_add_constant (regs[E_SP_REGNUM], d8), pv_add_constant (regs[E_SP_REGNUM], d8),
@ -816,7 +817,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4; sM = (buf[0] & 0xf0) >> 4;
fsM = (Y << 4) | sM; fsM = (Y << 4) | sM;
d24 = extract_signed_integer (&buf[1], 3); d24 = extract_signed_integer (&buf[1], 3, byte_order);
pv_area_store (stack, pv_area_store (stack,
pv_add_constant (regs[E_SP_REGNUM], d24), pv_add_constant (regs[E_SP_REGNUM], d24),
@ -839,7 +840,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4; sM = (buf[0] & 0xf0) >> 4;
fsM = (Y << 4) | sM; fsM = (Y << 4) | sM;
d32 = extract_signed_integer (&buf[1], 4); d32 = extract_signed_integer (&buf[1], 4, byte_order);
pv_area_store (stack, pv_area_store (stack,
pv_add_constant (regs[E_SP_REGNUM], d32), pv_add_constant (regs[E_SP_REGNUM], d32),
@ -887,7 +888,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4; sM = (buf[0] & 0xf0) >> 4;
rN = buf[0] & 0x0f; rN = buf[0] & 0x0f;
fsM = (Y << 4) | sM; fsM = (Y << 4) | sM;
imm8 = extract_signed_integer (&buf[1], 1); imm8 = extract_signed_integer (&buf[1], 1, byte_order);
rN_regnum = translate_rreg (rN); rN_regnum = translate_rreg (rN);
@ -912,7 +913,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4; sM = (buf[0] & 0xf0) >> 4;
rN = buf[0] & 0x0f; rN = buf[0] & 0x0f;
fsM = (Y << 4) | sM; fsM = (Y << 4) | sM;
imm24 = extract_signed_integer (&buf[1], 3); imm24 = extract_signed_integer (&buf[1], 3, byte_order);
rN_regnum = translate_rreg (rN); rN_regnum = translate_rreg (rN);
@ -937,7 +938,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
sM = (buf[0] & 0xf0) >> 4; sM = (buf[0] & 0xf0) >> 4;
rN = buf[0] & 0x0f; rN = buf[0] & 0x0f;
fsM = (Y << 4) | sM; fsM = (Y << 4) | sM;
imm32 = extract_signed_integer (&buf[1], 4); imm32 = extract_signed_integer (&buf[1], 4, byte_order);
rN_regnum = translate_rreg (rN); rN_regnum = translate_rreg (rN);
@ -952,7 +953,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
int aN = instr[0] & 0x03; int aN = instr[0] & 0x03;
LONGEST imm8; LONGEST imm8;
imm8 = extract_signed_integer (&instr[1], 1); imm8 = extract_signed_integer (&instr[1], 1, byte_order);
regs[E_A0_REGNUM + aN] = pv_constant (imm8); regs[E_A0_REGNUM + aN] = pv_constant (imm8);
pc += 2; pc += 2;
@ -968,7 +969,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
if (status != 0) if (status != 0)
break; break;
imm16 = extract_signed_integer (buf, 2); imm16 = extract_signed_integer (buf, 2, byte_order);
regs[E_A0_REGNUM + aN] = pv_constant (imm16); regs[E_A0_REGNUM + aN] = pv_constant (imm16);
pc += 3; pc += 3;
} }
@ -983,7 +984,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
if (status != 0) if (status != 0)
break; break;
imm32 = extract_signed_integer (buf, 4); imm32 = extract_signed_integer (buf, 4, byte_order);
regs[E_A0_REGNUM + aN] = pv_constant (imm32); regs[E_A0_REGNUM + aN] = pv_constant (imm32);
pc += 6; pc += 6;
} }
@ -993,7 +994,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
int dN = instr[0] & 0x03; int dN = instr[0] & 0x03;
LONGEST imm8; LONGEST imm8;
imm8 = extract_signed_integer (&instr[1], 1); imm8 = extract_signed_integer (&instr[1], 1, byte_order);
regs[E_D0_REGNUM + dN] = pv_constant (imm8); regs[E_D0_REGNUM + dN] = pv_constant (imm8);
pc += 2; pc += 2;
@ -1009,7 +1010,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
if (status != 0) if (status != 0)
break; break;
imm16 = extract_signed_integer (buf, 2); imm16 = extract_signed_integer (buf, 2, byte_order);
regs[E_D0_REGNUM + dN] = pv_constant (imm16); regs[E_D0_REGNUM + dN] = pv_constant (imm16);
pc += 3; pc += 3;
} }
@ -1024,7 +1025,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch,
if (status != 0) if (status != 0)
break; break;
imm32 = extract_signed_integer (buf, 4); imm32 = extract_signed_integer (buf, 4, byte_order);
regs[E_D0_REGNUM + dN] = pv_constant (imm32); regs[E_D0_REGNUM + dN] = pv_constant (imm32);
pc += 6; pc += 6;
} }
@ -1223,6 +1224,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
int struct_return, int struct_return,
CORE_ADDR struct_addr) CORE_ADDR struct_addr)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const int push_size = register_size (gdbarch, E_PC_REGNUM); const int push_size = register_size (gdbarch, E_PC_REGNUM);
int regs_used; int regs_used;
int len, arg_len; int len, arg_len;
@ -1270,7 +1272,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
{ {
/* Change to pointer-to-type. */ /* Change to pointer-to-type. */
arg_len = push_size; arg_len = push_size;
store_unsigned_integer (valbuf, push_size, store_unsigned_integer (valbuf, push_size, byte_order,
value_address (*args)); value_address (*args));
val = &valbuf[0]; val = &valbuf[0];
} }
@ -1283,7 +1285,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
while (regs_used < 2 && arg_len > 0) while (regs_used < 2 && arg_len > 0)
{ {
regcache_cooked_write_unsigned (regcache, regs_used, regcache_cooked_write_unsigned (regcache, regs_used,
extract_unsigned_integer (val, push_size)); extract_unsigned_integer (val, push_size, byte_order));
val += push_size; val += push_size;
arg_len -= push_size; arg_len -= push_size;
regs_used++; regs_used++;
@ -1305,7 +1307,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
/* Push the return address that contains the magic breakpoint. */ /* Push the return address that contains the magic breakpoint. */
sp -= 4; sp -= 4;
write_memory_unsigned_integer (sp, push_size, bp_addr); write_memory_unsigned_integer (sp, push_size, byte_order, bp_addr);
/* The CPU also writes the return address always into the /* The CPU also writes the return address always into the
MDR register on "call". */ MDR register on "call". */

View file

@ -870,6 +870,8 @@ monitor_detach (struct target_ops *ops, char *args, int from_tty)
char * char *
monitor_supply_register (struct regcache *regcache, int regno, char *valstr) monitor_supply_register (struct regcache *regcache, int regno, char *valstr)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST val; ULONGEST val;
unsigned char regbuf[MAX_REGISTER_SIZE]; unsigned char regbuf[MAX_REGISTER_SIZE];
char *p; char *p;
@ -905,8 +907,7 @@ monitor_supply_register (struct regcache *regcache, int regno, char *valstr)
/* supply register stores in target byte order, so swap here */ /* supply register stores in target byte order, so swap here */
store_unsigned_integer (regbuf, store_unsigned_integer (regbuf, register_size (gdbarch, regno), byte_order,
register_size (get_regcache_arch (regcache), regno),
val); val);
regcache_raw_supply (regcache, regno, regbuf); regcache_raw_supply (regcache, regno, regbuf);
@ -1409,6 +1410,7 @@ monitor_files_info (struct target_ops *ops)
static int static int
monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len) monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
unsigned int val, hostval; unsigned int val, hostval;
char *cmd; char *cmd;
int i; int i;
@ -1465,7 +1467,7 @@ monitor_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
cmd = current_monitor->setmem.cmdb; cmd = current_monitor->setmem.cmdb;
} }
val = extract_unsigned_integer (myaddr, len); val = extract_unsigned_integer (myaddr, len, byte_order);
if (len == 4) if (len == 4)
{ {
@ -1670,6 +1672,7 @@ monitor_write_memory_block (CORE_ADDR memaddr, char *myaddr, int len)
static int static int
monitor_read_memory_single (CORE_ADDR memaddr, char *myaddr, int len) monitor_read_memory_single (CORE_ADDR memaddr, char *myaddr, int len)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
unsigned int val; unsigned int val;
char membuf[sizeof (int) * 2 + 1]; char membuf[sizeof (int) * 2 + 1];
char *p; char *p;
@ -1786,7 +1789,7 @@ monitor_read_memory_single (CORE_ADDR memaddr, char *myaddr, int len)
/* supply register stores in target byte order, so swap here */ /* supply register stores in target byte order, so swap here */
store_unsigned_integer (myaddr, len, val); store_unsigned_integer (myaddr, len, byte_order, val);
return len; return len;
} }

View file

@ -120,15 +120,18 @@ static void
moxie_store_return_value (struct type *type, struct regcache *regcache, moxie_store_return_value (struct type *type, struct regcache *regcache,
const void *valbuf) const void *valbuf)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR regval; CORE_ADDR regval;
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
/* Things always get returned in RET1_REGNUM, RET2_REGNUM. */ /* Things always get returned in RET1_REGNUM, RET2_REGNUM. */
regval = extract_unsigned_integer (valbuf, len > 4 ? 4 : len); regval = extract_unsigned_integer (valbuf, len > 4 ? 4 : len, byte_order);
regcache_cooked_write_unsigned (regcache, RET1_REGNUM, regval); regcache_cooked_write_unsigned (regcache, RET1_REGNUM, regval);
if (len > 4) if (len > 4)
{ {
regval = extract_unsigned_integer ((gdb_byte *) valbuf + 4, len - 4); regval = extract_unsigned_integer ((gdb_byte *) valbuf + 4,
len - 4, byte_order);
regcache_cooked_write_unsigned (regcache, RET1_REGNUM + 1, regval); regcache_cooked_write_unsigned (regcache, RET1_REGNUM + 1, regval);
} }
} }
@ -144,6 +147,8 @@ moxie_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
struct moxie_frame_cache *cache, struct moxie_frame_cache *cache,
struct frame_info *this_frame) struct frame_info *this_frame)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR next_addr; CORE_ADDR next_addr;
ULONGEST inst, inst2; ULONGEST inst, inst2;
LONGEST offset; LONGEST offset;
@ -159,7 +164,7 @@ moxie_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
for (next_addr = start_addr; next_addr < end_addr; ) for (next_addr = start_addr; next_addr < end_addr; )
{ {
inst = read_memory_unsigned_integer (next_addr, 2); inst = read_memory_unsigned_integer (next_addr, 2, byte_order);
/* Match "push $rN" where N is between 2 and 13 inclusive. */ /* Match "push $rN" where N is between 2 and 13 inclusive. */
if (inst >= 0x0614 && inst <= 0x061f) if (inst >= 0x0614 && inst <= 0x061f)
@ -174,8 +179,8 @@ moxie_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
byte. */ byte. */
else if (inst == 0x01f0) /* ldi.l $r12, X */ else if (inst == 0x01f0) /* ldi.l $r12, X */
{ {
offset = read_memory_integer (next_addr + 2, 4); offset = read_memory_integer (next_addr + 2, 4, byte_order);
inst2 = read_memory_unsigned_integer (next_addr + 6, 2); inst2 = read_memory_unsigned_integer (next_addr + 6, 2, byte_order);
if (inst2 == 0x051f) /* add.l $sp, $r12 */ if (inst2 == 0x051f) /* add.l $sp, $r12 */
{ {
@ -297,6 +302,8 @@ static void
moxie_extract_return_value (struct type *type, struct regcache *regcache, moxie_extract_return_value (struct type *type, struct regcache *regcache,
void *dst) void *dst)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
bfd_byte *valbuf = dst; bfd_byte *valbuf = dst;
int len = TYPE_LENGTH (type); int len = TYPE_LENGTH (type);
ULONGEST tmp; ULONGEST tmp;
@ -304,14 +311,14 @@ moxie_extract_return_value (struct type *type, struct regcache *regcache,
/* By using store_unsigned_integer we avoid having to do /* By using store_unsigned_integer we avoid having to do
anything special for small big-endian values. */ anything special for small big-endian values. */
regcache_cooked_read_unsigned (regcache, RET1_REGNUM, &tmp); regcache_cooked_read_unsigned (regcache, RET1_REGNUM, &tmp);
store_unsigned_integer (valbuf, (len > 4 ? len - 4 : len), tmp); store_unsigned_integer (valbuf, (len > 4 ? len - 4 : len), byte_order, tmp);
/* Ignore return values more than 8 bytes in size because the moxie /* Ignore return values more than 8 bytes in size because the moxie
returns anything more than 8 bytes in the stack. */ returns anything more than 8 bytes in the stack. */
if (len > 4) if (len > 4)
{ {
regcache_cooked_read_unsigned (regcache, RET1_REGNUM + 1, &tmp); regcache_cooked_read_unsigned (regcache, RET1_REGNUM + 1, &tmp);
store_unsigned_integer (valbuf + len - 4, 4, tmp); store_unsigned_integer (valbuf + len - 4, 4, byte_order, tmp);
} }
} }

View file

@ -339,6 +339,8 @@ mt_return_value (struct gdbarch *gdbarch, struct type *func_type,
struct type *type, struct regcache *regcache, struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf) gdb_byte *readbuf, const gdb_byte *writebuf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (TYPE_LENGTH (type) > 4) if (TYPE_LENGTH (type) > 4)
{ {
/* Return values > 4 bytes are returned in memory, /* Return values > 4 bytes are returned in memory,
@ -369,7 +371,8 @@ mt_return_value (struct gdbarch *gdbarch, struct type *func_type,
/* Return values of <= 4 bytes are returned in R11. */ /* Return values of <= 4 bytes are returned in R11. */
regcache_cooked_read_unsigned (regcache, MT_R11_REGNUM, &temp); regcache_cooked_read_unsigned (regcache, MT_R11_REGNUM, &temp);
store_unsigned_integer (readbuf, TYPE_LENGTH (type), temp); store_unsigned_integer (readbuf, TYPE_LENGTH (type),
byte_order, temp);
} }
if (writebuf) if (writebuf)
@ -403,6 +406,7 @@ mt_return_value (struct gdbarch *gdbarch, struct type *func_type,
static CORE_ADDR static CORE_ADDR
mt_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) mt_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = 0, func_end = 0; CORE_ADDR func_addr = 0, func_end = 0;
char *func_name; char *func_name;
unsigned long instr; unsigned long instr;
@ -430,7 +434,7 @@ mt_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* No function symbol, or no line symbol. Use prologue scanning method. */ /* No function symbol, or no line symbol. Use prologue scanning method. */
for (;; pc += 4) for (;; pc += 4)
{ {
instr = read_memory_unsigned_integer (pc, 4); instr = read_memory_unsigned_integer (pc, 4, byte_order);
if (instr == 0x12000000) /* nop */ if (instr == 0x12000000) /* nop */
continue; continue;
if (instr == 0x12ddc000) /* copy sp into fp */ if (instr == 0x12ddc000) /* copy sp into fp */
@ -474,13 +478,15 @@ static int
mt_select_coprocessor (struct gdbarch *gdbarch, mt_select_coprocessor (struct gdbarch *gdbarch,
struct regcache *regcache, int regno) struct regcache *regcache, int regno)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned index, base; unsigned index, base;
gdb_byte copro[4]; gdb_byte copro[4];
/* Get the copro pseudo regnum. */ /* Get the copro pseudo regnum. */
regcache_raw_read (regcache, MT_COPRO_REGNUM, copro); regcache_raw_read (regcache, MT_COPRO_REGNUM, copro);
base = (extract_signed_integer (&copro[0], 2) * MT_COPRO_PSEUDOREG_DIM_2 base = ((extract_signed_integer (&copro[0], 2, byte_order)
+ extract_signed_integer (&copro[2], 2)); * MT_COPRO_PSEUDOREG_DIM_2)
+ extract_signed_integer (&copro[2], 2, byte_order));
regno -= MT_COPRO_PSEUDOREG_ARRAY; regno -= MT_COPRO_PSEUDOREG_ARRAY;
index = regno % MT_COPRO_PSEUDOREG_REGS; index = regno % MT_COPRO_PSEUDOREG_REGS;
@ -491,8 +497,10 @@ mt_select_coprocessor (struct gdbarch *gdbarch,
coprocessor register cache. */ coprocessor register cache. */
unsigned ix; unsigned ix;
store_signed_integer (&copro[0], 2, regno / MT_COPRO_PSEUDOREG_DIM_2); store_signed_integer (&copro[0], 2, byte_order,
store_signed_integer (&copro[2], 2, regno % MT_COPRO_PSEUDOREG_DIM_2); regno / MT_COPRO_PSEUDOREG_DIM_2);
store_signed_integer (&copro[2], 2, byte_order,
regno % MT_COPRO_PSEUDOREG_DIM_2);
regcache_raw_write (regcache, MT_COPRO_REGNUM, copro); regcache_raw_write (regcache, MT_COPRO_REGNUM, copro);
/* We must flush the cache, as it is now invalid. */ /* We must flush the cache, as it is now invalid. */
@ -519,6 +527,8 @@ static void
mt_pseudo_register_read (struct gdbarch *gdbarch, mt_pseudo_register_read (struct gdbarch *gdbarch,
struct regcache *regcache, int regno, gdb_byte *buf) struct regcache *regcache, int regno, gdb_byte *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
switch (regno) switch (regno)
{ {
case MT_COPRO_REGNUM: case MT_COPRO_REGNUM:
@ -537,7 +547,7 @@ mt_pseudo_register_read (struct gdbarch *gdbarch,
regcache_cooked_read_unsigned (regcache, MT_EXMAC_REGNUM, &ext_mac); regcache_cooked_read_unsigned (regcache, MT_EXMAC_REGNUM, &ext_mac);
newmac = newmac =
(oldmac & 0xffffffff) | ((long long) (ext_mac & 0xff) << 32); (oldmac & 0xffffffff) | ((long long) (ext_mac & 0xff) << 32);
store_signed_integer (buf, 8, newmac); store_signed_integer (buf, 8, byte_order, newmac);
} }
else else
regcache_raw_read (regcache, MT_MAC_REGNUM, buf); regcache_raw_read (regcache, MT_MAC_REGNUM, buf);
@ -567,6 +577,7 @@ mt_pseudo_register_write (struct gdbarch *gdbarch,
struct regcache *regcache, struct regcache *regcache,
int regno, const gdb_byte *buf) int regno, const gdb_byte *buf)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i; int i;
switch (regno) switch (regno)
@ -587,7 +598,7 @@ mt_pseudo_register_write (struct gdbarch *gdbarch,
unsigned int oldmac, ext_mac; unsigned int oldmac, ext_mac;
ULONGEST newmac; ULONGEST newmac;
newmac = extract_unsigned_integer (buf, 8); newmac = extract_unsigned_integer (buf, 8, byte_order);
oldmac = newmac & 0xffffffff; oldmac = newmac & 0xffffffff;
ext_mac = (newmac >> 32) & 0xff; ext_mac = (newmac >> 32) & 0xff;
regcache_cooked_write_unsigned (regcache, MT_MAC_REGNUM, oldmac); regcache_cooked_write_unsigned (regcache, MT_MAC_REGNUM, oldmac);
@ -626,6 +637,8 @@ mt_registers_info (struct gdbarch *gdbarch,
struct ui_file *file, struct ui_file *file,
struct frame_info *frame, int regnum, int all) struct frame_info *frame, int regnum, int all)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (regnum == -1) if (regnum == -1)
{ {
int lim; int lim;
@ -672,10 +685,10 @@ mt_registers_info (struct gdbarch *gdbarch,
for (i = 0; i < regsize; i++) for (i = 0; i < regsize; i++)
fprintf_filtered (file, "%02x", (unsigned int) fprintf_filtered (file, "%02x", (unsigned int)
extract_unsigned_integer (buff + i, 1)); extract_unsigned_integer (buff + i, 1, byte_order));
fputs_filtered ("\t", file); fputs_filtered ("\t", file);
print_longest (file, 'd', 0, print_longest (file, 'd', 0,
extract_unsigned_integer (buff, regsize)); extract_unsigned_integer (buff, regsize, byte_order));
fputs_filtered ("\n", file); fputs_filtered ("\n", file);
} }
else if (regnum == MT_COPRO_REGNUM else if (regnum == MT_COPRO_REGNUM
@ -709,13 +722,13 @@ mt_registers_info (struct gdbarch *gdbarch,
/* Get the two "real" mac registers. */ /* Get the two "real" mac registers. */
frame_register_read (frame, MT_MAC_REGNUM, buf); frame_register_read (frame, MT_MAC_REGNUM, buf);
oldmac = extract_unsigned_integer oldmac = extract_unsigned_integer
(buf, register_size (gdbarch, MT_MAC_REGNUM)); (buf, register_size (gdbarch, MT_MAC_REGNUM), byte_order);
if (gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_mrisc2 if (gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_mrisc2
|| gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_ms2) || gdbarch_bfd_arch_info (gdbarch)->mach == bfd_mach_ms2)
{ {
frame_register_read (frame, MT_EXMAC_REGNUM, buf); frame_register_read (frame, MT_EXMAC_REGNUM, buf);
ext_mac = extract_unsigned_integer ext_mac = extract_unsigned_integer
(buf, register_size (gdbarch, MT_EXMAC_REGNUM)); (buf, register_size (gdbarch, MT_EXMAC_REGNUM), byte_order);
} }
else else
ext_mac = 0; ext_mac = 0;
@ -755,6 +768,7 @@ mt_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
#define wordsize 4 #define wordsize 4
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_byte buf[MT_MAX_STRUCT_SIZE]; gdb_byte buf[MT_MAX_STRUCT_SIZE];
int argreg = MT_1ST_ARGREG; int argreg = MT_1ST_ARGREG;
int split_param_len = 0; int split_param_len = 0;
@ -778,7 +792,7 @@ mt_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_unsigned (regcache, argreg++, regcache_cooked_write_unsigned (regcache, argreg++,
extract_unsigned_integer extract_unsigned_integer
(value_contents (args[i]), (value_contents (args[i]),
wordsize)); wordsize, byte_order));
break; break;
case 8: case 8:
case 12: case 12:
@ -791,7 +805,7 @@ mt_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* This word of the argument is passed in a register. */ /* This word of the argument is passed in a register. */
regcache_cooked_write_unsigned (regcache, argreg++, regcache_cooked_write_unsigned (regcache, argreg++,
extract_unsigned_integer extract_unsigned_integer
(val, wordsize)); (val, wordsize, byte_order));
typelen -= wordsize; typelen -= wordsize;
val += wordsize; val += wordsize;
} }

View file

@ -1610,58 +1610,69 @@ _initialize_objc_language (void)
} }
static void static void
read_objc_method (CORE_ADDR addr, struct objc_method *method) read_objc_method (struct gdbarch *gdbarch, CORE_ADDR addr,
struct objc_method *method)
{ {
method->name = read_memory_unsigned_integer (addr + 0, 4); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
method->types = read_memory_unsigned_integer (addr + 4, 4); method->name = read_memory_unsigned_integer (addr + 0, 4, byte_order);
method->imp = read_memory_unsigned_integer (addr + 8, 4); method->types = read_memory_unsigned_integer (addr + 4, 4, byte_order);
method->imp = read_memory_unsigned_integer (addr + 8, 4, byte_order);
} }
static static unsigned long
unsigned long read_objc_methlist_nmethods (CORE_ADDR addr) read_objc_methlist_nmethods (struct gdbarch *gdbarch, CORE_ADDR addr)
{ {
return read_memory_unsigned_integer (addr + 4, 4); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
return read_memory_unsigned_integer (addr + 4, 4, byte_order);
} }
static void static void
read_objc_methlist_method (CORE_ADDR addr, unsigned long num, read_objc_methlist_method (struct gdbarch *gdbarch, CORE_ADDR addr,
struct objc_method *method) unsigned long num, struct objc_method *method)
{ {
gdb_assert (num < read_objc_methlist_nmethods (addr)); gdb_assert (num < read_objc_methlist_nmethods (gdbarch, addr));
read_objc_method (addr + 8 + (12 * num), method); read_objc_method (gdbarch, addr + 8 + (12 * num), method);
} }
static void static void
read_objc_object (CORE_ADDR addr, struct objc_object *object) read_objc_object (struct gdbarch *gdbarch, CORE_ADDR addr,
struct objc_object *object)
{ {
object->isa = read_memory_unsigned_integer (addr, 4); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
object->isa = read_memory_unsigned_integer (addr, 4, byte_order);
} }
static void static void
read_objc_super (CORE_ADDR addr, struct objc_super *super) read_objc_super (struct gdbarch *gdbarch, CORE_ADDR addr,
struct objc_super *super)
{ {
super->receiver = read_memory_unsigned_integer (addr, 4); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
super->class = read_memory_unsigned_integer (addr + 4, 4); super->receiver = read_memory_unsigned_integer (addr, 4, byte_order);
super->class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
}; };
static void static void
read_objc_class (CORE_ADDR addr, struct objc_class *class) read_objc_class (struct gdbarch *gdbarch, CORE_ADDR addr,
struct objc_class *class)
{ {
class->isa = read_memory_unsigned_integer (addr, 4); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
class->super_class = read_memory_unsigned_integer (addr + 4, 4); class->isa = read_memory_unsigned_integer (addr, 4, byte_order);
class->name = read_memory_unsigned_integer (addr + 8, 4); class->super_class = read_memory_unsigned_integer (addr + 4, 4, byte_order);
class->version = read_memory_unsigned_integer (addr + 12, 4); class->name = read_memory_unsigned_integer (addr + 8, 4, byte_order);
class->info = read_memory_unsigned_integer (addr + 16, 4); class->version = read_memory_unsigned_integer (addr + 12, 4, byte_order);
class->instance_size = read_memory_unsigned_integer (addr + 18, 4); class->info = read_memory_unsigned_integer (addr + 16, 4, byte_order);
class->ivars = read_memory_unsigned_integer (addr + 24, 4); class->instance_size = read_memory_unsigned_integer (addr + 18, 4, byte_order);
class->methods = read_memory_unsigned_integer (addr + 28, 4); class->ivars = read_memory_unsigned_integer (addr + 24, 4, byte_order);
class->cache = read_memory_unsigned_integer (addr + 32, 4); class->methods = read_memory_unsigned_integer (addr + 28, 4, byte_order);
class->protocols = read_memory_unsigned_integer (addr + 36, 4); class->cache = read_memory_unsigned_integer (addr + 32, 4, byte_order);
class->protocols = read_memory_unsigned_integer (addr + 36, 4, byte_order);
} }
static CORE_ADDR static CORE_ADDR
find_implementation_from_class (CORE_ADDR class, CORE_ADDR sel) find_implementation_from_class (struct gdbarch *gdbarch,
CORE_ADDR class, CORE_ADDR sel)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR subclass = class; CORE_ADDR subclass = class;
while (subclass != 0) while (subclass != 0)
@ -1670,7 +1681,7 @@ find_implementation_from_class (CORE_ADDR class, CORE_ADDR sel)
struct objc_class class_str; struct objc_class class_str;
unsigned mlistnum = 0; unsigned mlistnum = 0;
read_objc_class (subclass, &class_str); read_objc_class (gdbarch, subclass, &class_str);
for (;;) for (;;)
{ {
@ -1679,16 +1690,17 @@ find_implementation_from_class (CORE_ADDR class, CORE_ADDR sel)
unsigned long i; unsigned long i;
mlist = read_memory_unsigned_integer (class_str.methods + mlist = read_memory_unsigned_integer (class_str.methods +
(4 * mlistnum), 4); (4 * mlistnum),
4, byte_order);
if (mlist == 0) if (mlist == 0)
break; break;
nmethods = read_objc_methlist_nmethods (mlist); nmethods = read_objc_methlist_nmethods (gdbarch, mlist);
for (i = 0; i < nmethods; i++) for (i = 0; i < nmethods; i++)
{ {
struct objc_method meth_str; struct objc_method meth_str;
read_objc_methlist_method (mlist, i, &meth_str); read_objc_methlist_method (gdbarch, mlist, i, &meth_str);
#if 0 #if 0
fprintf (stderr, fprintf (stderr,
@ -1710,17 +1722,18 @@ find_implementation_from_class (CORE_ADDR class, CORE_ADDR sel)
} }
static CORE_ADDR static CORE_ADDR
find_implementation (CORE_ADDR object, CORE_ADDR sel) find_implementation (struct gdbarch *gdbarch,
CORE_ADDR object, CORE_ADDR sel)
{ {
struct objc_object ostr; struct objc_object ostr;
if (object == 0) if (object == 0)
return 0; return 0;
read_objc_object (object, &ostr); read_objc_object (gdbarch, object, &ostr);
if (ostr.isa == 0) if (ostr.isa == 0)
return 0; return 0;
return find_implementation_from_class (ostr.isa, sel); return find_implementation_from_class (gdbarch, ostr.isa, sel);
} }
static int static int
@ -1737,7 +1750,7 @@ resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc)
object = gdbarch_fetch_pointer_argument (gdbarch, frame, 0, ptr_type); object = gdbarch_fetch_pointer_argument (gdbarch, frame, 0, ptr_type);
sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type); sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
res = find_implementation (object, sel); res = find_implementation (gdbarch, object, sel);
if (new_pc != 0) if (new_pc != 0)
*new_pc = res; *new_pc = res;
if (res == 0) if (res == 0)
@ -1759,7 +1772,7 @@ resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
object = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type); object = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type); sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type);
res = find_implementation (object, sel); res = find_implementation (gdbarch, object, sel);
if (new_pc != 0) if (new_pc != 0)
*new_pc = res; *new_pc = res;
if (res == 0) if (res == 0)
@ -1783,11 +1796,11 @@ resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc)
super = gdbarch_fetch_pointer_argument (gdbarch, frame, 0, ptr_type); super = gdbarch_fetch_pointer_argument (gdbarch, frame, 0, ptr_type);
sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type); sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
read_objc_super (super, &sstr); read_objc_super (gdbarch, super, &sstr);
if (sstr.class == 0) if (sstr.class == 0)
return 0; return 0;
res = find_implementation_from_class (sstr.class, sel); res = find_implementation_from_class (gdbarch, sstr.class, sel);
if (new_pc != 0) if (new_pc != 0)
*new_pc = res; *new_pc = res;
if (res == 0) if (res == 0)
@ -1811,11 +1824,11 @@ resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
super = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type); super = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type); sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type);
read_objc_super (super, &sstr); read_objc_super (gdbarch, super, &sstr);
if (sstr.class == 0) if (sstr.class == 0)
return 0; return 0;
res = find_implementation_from_class (sstr.class, sel); res = find_implementation_from_class (gdbarch, sstr.class, sel);
if (new_pc != 0) if (new_pc != 0)
*new_pc = res; *new_pc = res;
if (res == 0) if (res == 0)

View file

@ -217,6 +217,7 @@ pascal_printstr (struct ui_file *stream, struct type *type,
int force_ellipses, int force_ellipses,
const struct value_print_options *options) const struct value_print_options *options)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
unsigned int i; unsigned int i;
unsigned int things_printed = 0; unsigned int things_printed = 0;
int in_quotes = 0; int in_quotes = 0;
@ -227,7 +228,8 @@ pascal_printstr (struct ui_file *stream, struct type *type,
the last byte of it is a null, we don't print that, in traditional C the last byte of it is a null, we don't print that, in traditional C
style. */ style. */
if ((!force_ellipses) && length > 0 if ((!force_ellipses) && length > 0
&& extract_unsigned_integer (string + (length - 1) * width, width) == 0) && extract_unsigned_integer (string + (length - 1) * width, width,
byte_order) == 0)
length--; length--;
if (length == 0) if (length == 0)
@ -253,13 +255,14 @@ pascal_printstr (struct ui_file *stream, struct type *type,
need_comma = 0; need_comma = 0;
} }
current_char = extract_unsigned_integer (string + i * width, width); current_char = extract_unsigned_integer (string + i * width, width,
byte_order);
rep1 = i + 1; rep1 = i + 1;
reps = 1; reps = 1;
while (rep1 < length while (rep1 < length
&& extract_unsigned_integer (string + rep1 * width, width) && extract_unsigned_integer (string + rep1 * width, width,
== current_char) byte_order) == current_char)
{ {
++rep1; ++rep1;
++reps; ++reps;

View file

@ -57,6 +57,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
const struct value_print_options *options) const struct value_print_options *options)
{ {
struct gdbarch *gdbarch = get_type_arch (type); struct gdbarch *gdbarch = get_type_arch (type);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
unsigned int i = 0; /* Number of characters printed */ unsigned int i = 0; /* Number of characters printed */
unsigned len; unsigned len;
struct type *elttype; struct type *elttype;
@ -95,7 +96,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
/* Look for a NULL char. */ /* Look for a NULL char. */
for (temp_len = 0; for (temp_len = 0;
extract_unsigned_integer (valaddr + embedded_offset + extract_unsigned_integer (valaddr + embedded_offset +
temp_len * eltlen, eltlen) temp_len * eltlen, eltlen,
byte_order)
&& temp_len < len && temp_len < options->print_max; && temp_len < len && temp_len < options->print_max;
temp_len++); temp_len++);
len = temp_len; len = temp_len;
@ -143,9 +145,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
/* Print vtable entry - we only get here if we ARE using /* Print vtable entry - we only get here if we ARE using
-fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */ -fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
/* Extract the address, assume that it is unsigned. */ /* Extract the address, assume that it is unsigned. */
print_address_demangle (gdbarch, addr = extract_unsigned_integer (valaddr + embedded_offset,
extract_unsigned_integer (valaddr + embedded_offset, TYPE_LENGTH (type)), TYPE_LENGTH (type), byte_order);
stream, demangle); print_address_demangle (gdbarch, addr, stream, demangle);
break; break;
} }
elttype = check_typedef (TYPE_TARGET_TYPE (type)); elttype = check_typedef (TYPE_TARGET_TYPE (type));
@ -193,7 +195,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
void *buffer; void *buffer;
buffer = xmalloc (length_size); buffer = xmalloc (length_size);
read_memory (addr + length_pos, buffer, length_size); read_memory (addr + length_pos, buffer, length_size);
string_length = extract_unsigned_integer (buffer, length_size); string_length = extract_unsigned_integer (buffer, length_size,
byte_order);
xfree (buffer); xfree (buffer);
i = val_print_string (char_type ,addr + string_pos, string_length, stream, options); i = val_print_string (char_type ,addr + string_pos, string_length, stream, options);
} }
@ -294,7 +297,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
print_address_demangle print_address_demangle
(gdbarch, (gdbarch,
extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8, extract_unsigned_integer (valaddr + embedded_offset + TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))), TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET)), byte_order),
stream, demangle); stream, demangle);
} }
else else
@ -302,7 +305,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
if (is_pascal_string_type (type, &length_pos, &length_size, if (is_pascal_string_type (type, &length_pos, &length_size,
&string_pos, &char_type, NULL)) &string_pos, &char_type, NULL))
{ {
len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size); len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size, byte_order);
LA_PRINT_STRING (stream, char_type, valaddr + embedded_offset + string_pos, len, 0, options); LA_PRINT_STRING (stream, char_type, valaddr + embedded_offset + string_pos, len, 0, options);
} }
else else

View file

@ -1523,6 +1523,7 @@ ppc_linux_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{ {
int sizeof_auxv_field = ppc_linux_target_wordsize (); int sizeof_auxv_field = ppc_linux_target_wordsize ();
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
gdb_byte *ptr = *readptr; gdb_byte *ptr = *readptr;
if (endptr == ptr) if (endptr == ptr)
@ -1531,9 +1532,9 @@ ppc_linux_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
if (endptr - ptr < sizeof_auxv_field * 2) if (endptr - ptr < sizeof_auxv_field * 2)
return -1; return -1;
*typep = extract_unsigned_integer (ptr, sizeof_auxv_field); *typep = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
ptr += sizeof_auxv_field; ptr += sizeof_auxv_field;
*valp = extract_unsigned_integer (ptr, sizeof_auxv_field); *valp = extract_unsigned_integer (ptr, sizeof_auxv_field, byte_order);
ptr += sizeof_auxv_field; ptr += sizeof_auxv_field;
*readptr = ptr; *readptr = ptr;

View file

@ -329,10 +329,11 @@ insn_ds_field (unsigned int insn)
/* If DESC is the address of a 64-bit PowerPC GNU/Linux function /* If DESC is the address of a 64-bit PowerPC GNU/Linux function
descriptor, return the descriptor's entry point. */ descriptor, return the descriptor's entry point. */
static CORE_ADDR static CORE_ADDR
ppc64_desc_entry_point (CORE_ADDR desc) ppc64_desc_entry_point (struct gdbarch *gdbarch, CORE_ADDR desc)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* The first word of the descriptor is the entry point. */ /* The first word of the descriptor is the entry point. */
return (CORE_ADDR) read_memory_unsigned_integer (desc, 8); return (CORE_ADDR) read_memory_unsigned_integer (desc, 8, byte_order);
} }
@ -483,7 +484,8 @@ static CORE_ADDR
ppc64_standard_linkage1_target (struct frame_info *frame, ppc64_standard_linkage1_target (struct frame_info *frame,
CORE_ADDR pc, unsigned int *insn) CORE_ADDR pc, unsigned int *insn)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame)); struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* The address of the function descriptor this linkage function /* The address of the function descriptor this linkage function
references. */ references. */
@ -494,7 +496,7 @@ ppc64_standard_linkage1_target (struct frame_info *frame,
+ insn_ds_field (insn[2])); + insn_ds_field (insn[2]));
/* The first word of the descriptor is the entry point. Return that. */ /* The first word of the descriptor is the entry point. Return that. */
return ppc64_desc_entry_point (desc); return ppc64_desc_entry_point (gdbarch, desc);
} }
static struct core_regset_section ppc_linux_vsx_regset_sections[] = static struct core_regset_section ppc_linux_vsx_regset_sections[] =
@ -525,7 +527,8 @@ static CORE_ADDR
ppc64_standard_linkage2_target (struct frame_info *frame, ppc64_standard_linkage2_target (struct frame_info *frame,
CORE_ADDR pc, unsigned int *insn) CORE_ADDR pc, unsigned int *insn)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame)); struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* The address of the function descriptor this linkage function /* The address of the function descriptor this linkage function
references. */ references. */
@ -536,14 +539,15 @@ ppc64_standard_linkage2_target (struct frame_info *frame,
+ insn_ds_field (insn[2])); + insn_ds_field (insn[2]));
/* The first word of the descriptor is the entry point. Return that. */ /* The first word of the descriptor is the entry point. Return that. */
return ppc64_desc_entry_point (desc); return ppc64_desc_entry_point (gdbarch, desc);
} }
static CORE_ADDR static CORE_ADDR
ppc64_standard_linkage3_target (struct frame_info *frame, ppc64_standard_linkage3_target (struct frame_info *frame,
CORE_ADDR pc, unsigned int *insn) CORE_ADDR pc, unsigned int *insn)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame)); struct gdbarch *gdbarch = get_frame_arch (frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* The address of the function descriptor this linkage function /* The address of the function descriptor this linkage function
references. */ references. */
@ -553,7 +557,7 @@ ppc64_standard_linkage3_target (struct frame_info *frame,
+ insn_ds_field (insn[1])); + insn_ds_field (insn[1]));
/* The first word of the descriptor is the entry point. Return that. */ /* The first word of the descriptor is the entry point. Return that. */
return ppc64_desc_entry_point (desc); return ppc64_desc_entry_point (gdbarch, desc);
} }
@ -621,6 +625,7 @@ ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
CORE_ADDR addr, CORE_ADDR addr,
struct target_ops *targ) struct target_ops *targ)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct target_section *s = target_section_by_addr (targ, addr); struct target_section *s = target_section_by_addr (targ, addr);
/* Check if ADDR points to a function descriptor. */ /* Check if ADDR points to a function descriptor. */
@ -652,7 +657,7 @@ ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
res = bfd_get_section_contents (s->bfd, s->the_bfd_section, res = bfd_get_section_contents (s->bfd, s->the_bfd_section,
&buf, addr - s->addr, 8); &buf, addr - s->addr, 8);
if (res != 0) if (res != 0)
return extract_unsigned_integer (buf, 8) return extract_unsigned_integer (buf, 8, byte_order)
- bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr; - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr;
} }
@ -847,6 +852,7 @@ ppc_linux_sigtramp_cache (struct frame_info *this_frame,
int i; int i;
struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
base = get_frame_register_unsigned (this_frame, base = get_frame_register_unsigned (this_frame,
gdbarch_sp_regnum (gdbarch)); gdbarch_sp_regnum (gdbarch));
@ -859,7 +865,7 @@ ppc_linux_sigtramp_cache (struct frame_info *this_frame,
regs = base + offset; regs = base + offset;
/* Use that to find the address of the corresponding register /* Use that to find the address of the corresponding register
buffers. */ buffers. */
gpregs = read_memory_unsigned_integer (regs, tdep->wordsize); gpregs = read_memory_unsigned_integer (regs, tdep->wordsize, byte_order);
fpregs = gpregs + 48 * tdep->wordsize; fpregs = gpregs + 48 * tdep->wordsize;
/* General purpose. */ /* General purpose. */

View file

@ -49,6 +49,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int struct_return, CORE_ADDR struct_addr) int struct_return, CORE_ADDR struct_addr)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST saved_sp; ULONGEST saved_sp;
int argspace = 0; /* 0 is an initial wrong guess. */ int argspace = 0; /* 0 is an initial wrong guess. */
int write_pass; int write_pass;
@ -398,13 +399,13 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
write_memory (sp + structoffset, val, len); write_memory (sp + structoffset, val, len);
/* ... and then a "word" pointing to that address is /* ... and then a "word" pointing to that address is
passed as the parameter. */ passed as the parameter. */
store_unsigned_integer (word, tdep->wordsize, store_unsigned_integer (word, tdep->wordsize, byte_order,
sp + structoffset); sp + structoffset);
structoffset += len; structoffset += len;
} }
else if (TYPE_CODE (type) == TYPE_CODE_INT) else if (TYPE_CODE (type) == TYPE_CODE_INT)
/* Sign or zero extend the "int" into a "word". */ /* Sign or zero extend the "int" into a "word". */
store_unsigned_integer (word, tdep->wordsize, store_unsigned_integer (word, tdep->wordsize, byte_order,
unpack_long (type, val)); unpack_long (type, val));
else else
/* Always goes in the low address. */ /* Always goes in the low address. */
@ -462,7 +463,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp); regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
/* Write the backchain (it occupies WORDSIZED bytes). */ /* Write the backchain (it occupies WORDSIZED bytes). */
write_memory_signed_integer (sp, tdep->wordsize, saved_sp); write_memory_signed_integer (sp, tdep->wordsize, byte_order, saved_sp);
/* Point the inferior function call's return address at the dummy's /* Point the inferior function call's return address at the dummy's
breakpoint. */ breakpoint. */
@ -556,6 +557,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
const gdb_byte *writebuf, int broken_gcc) const gdb_byte *writebuf, int broken_gcc)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
gdb_assert (tdep->wordsize == 4); gdb_assert (tdep->wordsize == 4);
if (TYPE_CODE (type) == TYPE_CODE_FLT if (TYPE_CODE (type) == TYPE_CODE_FLT
&& TYPE_LENGTH (type) <= 8 && TYPE_LENGTH (type) <= 8
@ -675,7 +677,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
ULONGEST regval; ULONGEST regval;
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3, regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
&regval); &regval);
store_unsigned_integer (readbuf, TYPE_LENGTH (type), regval); store_unsigned_integer (readbuf, TYPE_LENGTH (type), byte_order,
regval);
} }
if (writebuf) if (writebuf)
{ {
@ -892,6 +895,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{ {
CORE_ADDR func_addr = find_function_addr (function, NULL); CORE_ADDR func_addr = find_function_addr (function, NULL);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
ULONGEST back_chain; ULONGEST back_chain;
/* See for-loop comment below. */ /* See for-loop comment below. */
int write_pass; int write_pass;
@ -1194,7 +1198,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
tdep->ppc_gp0_regnum + tdep->ppc_gp0_regnum +
greg, word); greg, word);
write_memory_unsigned_integer (gparam, tdep->wordsize, write_memory_unsigned_integer (gparam, tdep->wordsize,
word); byte_order, word);
} }
greg++; greg++;
gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize); gparam = align_up (gparam + TYPE_LENGTH (type), tdep->wordsize);
@ -1315,7 +1319,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp); regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp);
/* Write the backchain (it occupies WORDSIZED bytes). */ /* Write the backchain (it occupies WORDSIZED bytes). */
write_memory_signed_integer (sp, tdep->wordsize, back_chain); write_memory_signed_integer (sp, tdep->wordsize, byte_order, back_chain);
/* Point the inferior function call's return address at the dummy's /* Point the inferior function call's return address at the dummy's
breakpoint. */ breakpoint. */
@ -1330,7 +1334,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* The TOC is the second double word in the descriptor. */ /* The TOC is the second double word in the descriptor. */
CORE_ADDR toc = CORE_ADDR toc =
read_memory_unsigned_integer (desc_addr + tdep->wordsize, read_memory_unsigned_integer (desc_addr + tdep->wordsize,
tdep->wordsize); tdep->wordsize, byte_order);
regcache_cooked_write_unsigned (regcache, regcache_cooked_write_unsigned (regcache,
tdep->ppc_gp0_regnum + 2, toc); tdep->ppc_gp0_regnum + 2, toc);
} }
@ -1356,6 +1360,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *func_type,
gdb_byte *readbuf, const gdb_byte *writebuf) gdb_byte *readbuf, const gdb_byte *writebuf)
{ {
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* This function exists to support a calling convention that /* This function exists to support a calling convention that
requires floating-point registers. It shouldn't be used on requires floating-point registers. It shouldn't be used on
@ -1402,7 +1407,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *func_type,
ULONGEST regval; ULONGEST regval;
regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3, regcache_cooked_read_unsigned (regcache, tdep->ppc_gp0_regnum + 3,
&regval); &regval);
store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), regval); store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), byte_order,
regval);
} }
return RETURN_VALUE_REGISTER_CONVENTION; return RETURN_VALUE_REGISTER_CONVENTION;
} }

View file

@ -126,6 +126,8 @@ ppcobsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame, struct frame_info *this_frame,
void **this_cache) void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR pc = get_frame_pc (this_frame); CORE_ADDR pc = get_frame_pc (this_frame);
CORE_ADDR start_pc = (pc & ~(ppcobsd_page_size - 1)); CORE_ADDR start_pc = (pc & ~(ppcobsd_page_size - 1));
const int *offset; const int *offset;
@ -145,12 +147,13 @@ ppcobsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
continue; continue;
/* Check for "li r0,SYS_sigreturn". */ /* Check for "li r0,SYS_sigreturn". */
insn = extract_unsigned_integer (buf, PPC_INSN_SIZE); insn = extract_unsigned_integer (buf, PPC_INSN_SIZE, byte_order);
if (insn != 0x38000067) if (insn != 0x38000067)
continue; continue;
/* Check for "sc". */ /* Check for "sc". */
insn = extract_unsigned_integer (buf + PPC_INSN_SIZE, PPC_INSN_SIZE); insn = extract_unsigned_integer (buf + PPC_INSN_SIZE,
PPC_INSN_SIZE, byte_order);
if (insn != 0x44000002) if (insn != 0x44000002)
continue; continue;
@ -165,6 +168,7 @@ ppcobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
{ {
struct gdbarch *gdbarch = get_frame_arch (this_frame); struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct trad_frame_cache *cache; struct trad_frame_cache *cache;
CORE_ADDR addr, base, func; CORE_ADDR addr, base, func;
gdb_byte buf[PPC_INSN_SIZE]; gdb_byte buf[PPC_INSN_SIZE];
@ -185,7 +189,7 @@ ppcobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
/* Calculate the offset where we can find `struct sigcontext'. We /* Calculate the offset where we can find `struct sigcontext'. We
base our calculation on the amount of stack space reserved by the base our calculation on the amount of stack space reserved by the
first instruction of the signal trampoline. */ first instruction of the signal trampoline. */
insn = extract_unsigned_integer (buf, PPC_INSN_SIZE); insn = extract_unsigned_integer (buf, PPC_INSN_SIZE, byte_order);
sigcontext_offset = (0x10000 - (insn & 0x0000ffff)) + 8; sigcontext_offset = (0x10000 - (insn & 0x0000ffff)) + 8;
base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch)); base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));

View file

@ -2282,6 +2282,7 @@ printf_command (char *arg, int from_tty)
int j; int j;
struct gdbarch *gdbarch struct gdbarch *gdbarch
= get_type_arch (value_type (val_args[i])); = get_type_arch (value_type (val_args[i]));
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct type *wctype = lookup_typename (current_language, gdbarch, struct type *wctype = lookup_typename (current_language, gdbarch,
"wchar_t", NULL, 0); "wchar_t", NULL, 0);
int wcwidth = TYPE_LENGTH (wctype); int wcwidth = TYPE_LENGTH (wctype);
@ -2296,7 +2297,7 @@ printf_command (char *arg, int from_tty)
{ {
QUIT; QUIT;
read_memory (tem + j, buf, wcwidth); read_memory (tem + j, buf, wcwidth);
if (extract_unsigned_integer (buf, wcwidth) == 0) if (extract_unsigned_integer (buf, wcwidth, byte_order) == 0)
break; break;
} }
@ -2309,7 +2310,7 @@ printf_command (char *arg, int from_tty)
obstack_init (&output); obstack_init (&output);
inner_cleanup = make_cleanup_obstack_free (&output); inner_cleanup = make_cleanup_obstack_free (&output);
convert_between_encodings (target_wide_charset (), convert_between_encodings (target_wide_charset (byte_order),
host_charset (), host_charset (),
str, j, wcwidth, str, j, wcwidth,
&output, translit_char); &output, translit_char);
@ -2323,6 +2324,7 @@ printf_command (char *arg, int from_tty)
{ {
struct gdbarch *gdbarch struct gdbarch *gdbarch
= get_type_arch (value_type (val_args[i])); = get_type_arch (value_type (val_args[i]));
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct type *wctype = lookup_typename (current_language, gdbarch, struct type *wctype = lookup_typename (current_language, gdbarch,
"wchar_t", NULL, 0); "wchar_t", NULL, 0);
struct type *valtype; struct type *valtype;
@ -2340,7 +2342,7 @@ printf_command (char *arg, int from_tty)
obstack_init (&output); obstack_init (&output);
inner_cleanup = make_cleanup_obstack_free (&output); inner_cleanup = make_cleanup_obstack_free (&output);
convert_between_encodings (target_wide_charset (), convert_between_encodings (target_wide_charset (byte_order),
host_charset (), host_charset (),
bytes, TYPE_LENGTH (valtype), bytes, TYPE_LENGTH (valtype),
TYPE_LENGTH (valtype), TYPE_LENGTH (valtype),
@ -2431,6 +2433,7 @@ printf_command (char *arg, int from_tty)
struct type *param_type = value_type (val_args[i]); struct type *param_type = value_type (val_args[i]);
unsigned int param_len = TYPE_LENGTH (param_type); unsigned int param_len = TYPE_LENGTH (param_type);
struct gdbarch *gdbarch = get_type_arch (param_type); struct gdbarch *gdbarch = get_type_arch (param_type);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* DFP output data. */ /* DFP output data. */
struct value *dfp_value = NULL; struct value *dfp_value = NULL;
@ -2490,18 +2493,19 @@ printf_command (char *arg, int from_tty)
/* Conversion between different DFP types. */ /* Conversion between different DFP types. */
if (TYPE_CODE (param_type) == TYPE_CODE_DECFLOAT) if (TYPE_CODE (param_type) == TYPE_CODE_DECFLOAT)
decimal_convert (param_ptr, param_len, dec, dfp_len); decimal_convert (param_ptr, param_len, byte_order,
dec, dfp_len, byte_order);
else else
/* If this is a non-trivial conversion, just output 0. /* If this is a non-trivial conversion, just output 0.
A correct converted value can be displayed by explicitly A correct converted value can be displayed by explicitly
casting to a DFP type. */ casting to a DFP type. */
decimal_from_string (dec, dfp_len, "0"); decimal_from_string (dec, dfp_len, byte_order, "0");
dfp_value = value_from_decfloat (dfp_type, dec); dfp_value = value_from_decfloat (dfp_type, dec);
dfp_ptr = (gdb_byte *) value_contents (dfp_value); dfp_ptr = (gdb_byte *) value_contents (dfp_value);
decimal_to_string (dfp_ptr, dfp_len, decstr); decimal_to_string (dfp_ptr, dfp_len, byte_order, decstr);
/* Print the DFP value. */ /* Print the DFP value. */
printf_filtered (current_substring, decstr); printf_filtered (current_substring, decstr);

View file

@ -162,6 +162,7 @@ static int
procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr, procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
{ {
enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
gdb_byte *ptr = *readptr; gdb_byte *ptr = *readptr;
if (endptr == ptr) if (endptr == ptr)
@ -170,11 +171,11 @@ procfs_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
if (endptr - ptr < 8 * 2) if (endptr - ptr < 8 * 2)
return -1; return -1;
*typep = extract_unsigned_integer (ptr, 4); *typep = extract_unsigned_integer (ptr, 4, byte_order);
ptr += 8; ptr += 8;
/* The size of data is always 64-bit. If the application is 32-bit, /* The size of data is always 64-bit. If the application is 32-bit,
it will be zero extended, as expected. */ it will be zero extended, as expected. */
*valp = extract_unsigned_integer (ptr, 8); *valp = extract_unsigned_integer (ptr, 8, byte_order);
ptr += 8; ptr += 8;
*readptr = ptr; *readptr = ptr;

Some files were not shown because too many files have changed in this diff Show more